From cf634e11a9658b71e25e00b02f7cabfeef4f44b3 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Sun, 3 Mar 2013 18:48:59 +0100 Subject: [PATCH] core/exceptions: fix leak in uwsgi_exception_handler_thread_loop Reported by Coverity as CID #989248. --- core/exceptions.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/exceptions.c b/core/exceptions.c index 32bf468a..fe7e69f6 100644 --- a/core/exceptions.c +++ b/core/exceptions.c @@ -452,13 +452,15 @@ static void uwsgi_exception_handler_thread_loop(struct uwsgi_thread *ut) { long ptr = 0; memcpy(&ptr, buf, sizeof(long)); struct uwsgi_exception_handler_instance *uehi = (struct uwsgi_exception_handler_instance *) ptr; - if (!uehi) return; + if (!uehi) + break; if (uehi->handler->func(uehi, msg, msg_size)) { uwsgi_log("[uwsgi-exception] error running the handler \"%s\" args: \"%s\"\n", uehi->handler->name, uehi->arg ? uehi->arg : ""); } } } } + free(buf); } void uwsgi_exception_setup_handlers() {