From 0cb2e6852bcee02484dea06b2c5e9c8f6cbb3138 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Sun, 27 Jan 2013 12:19:45 +0100 Subject: [PATCH] plugins/python: fix tracebaker resource leaks on import error Reported by Coverity as CID #971061, #971062, #971063. --- plugins/python/tracebacker.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/python/tracebacker.c b/plugins/python/tracebacker.c index 68cf444c..e602c194 100644 --- a/plugins/python/tracebacker.c +++ b/plugins/python/tracebacker.c @@ -63,7 +63,12 @@ void *uwsgi_python_tracebacker_thread(void *foobar) { uwsgi.no_defer_accept = current_defer_accept; PyObject *traceback_module = PyImport_ImportModule("traceback"); - if (!traceback_module) return NULL; + if (!traceback_module) { + free(str_wid); + free(sock_path); + close(fd); + return NULL; + } PyObject *traceback_dict = PyModule_GetDict(traceback_module); PyObject *extract_stack = PyDict_GetItemString(traceback_dict, "extract_stack");