From 27fb49fcf62210f91a9d7b206947ad279511676a Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Sat, 18 Oct 2014 11:26:18 +0000 Subject: [PATCH] Fix a memory leak in execute_content_filters() if there's more than one job Also don't crash if a job that isn't the last one fails. CID 66381. --- filters.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/filters.c b/filters.c index dfdfe38e..902381ba 100644 --- a/filters.c +++ b/filters.c @@ -1,4 +1,4 @@ -const char filters_rcs[] = "$Id: filters.c,v 1.187 2014/07/18 09:59:51 fabiankeil Exp $"; +const char filters_rcs[] = "$Id: filters.c,v 1.188 2014/10/18 11:25:57 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/filters.c,v $ @@ -2273,7 +2273,15 @@ char *execute_content_filters(struct client_state *csp) for (filtername = csp->action->multi[ACTION_MULTI_EXTERNAL_FILTER]->first; filtername ; filtername = filtername->next) { - content = execute_external_filter(csp, filtername->str, content, &size); + char *result = execute_external_filter(csp, filtername->str, content, &size); + if (result != NULL) + { + if (content != csp->iob->cur) + { + free(content); + } + content = result; + } } csp->flags |= CSP_FLAG_MODIFIED; csp->content_length = size; -- 2.39.2