From: Eric Bollengier Date: Fri, 23 Nov 2018 09:16:20 +0000 (+0100) Subject: Fix small memory leak with Console runscripts X-Git-Tag: Release-9.4.3~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74943dc1f7c152f5427170d8482288a22ffa4e97;p=thirdparty%2Fbacula.git Fix small memory leak with Console runscripts --- diff --git a/bacula/src/lib/runscript.c b/bacula/src/lib/runscript.c index 3aa7af501..e5e07fa4b 100644 --- a/bacula/src/lib/runscript.c +++ b/bacula/src/lib/runscript.c @@ -230,7 +230,6 @@ bool RUNSCRIPT::run(JCR *jcr, const char *name) switch (cmd_type) { case SHELL_CMD: bpipe = open_bpipe(ecmd, 0, "r"); - free_pool_memory(ecmd); if (bpipe == NULL) { berrno be; Jmsg(jcr, M_ERROR, 0, _("Runscript: %s could not execute. ERR=%s\n"), name, @@ -261,9 +260,11 @@ bool RUNSCRIPT::run(JCR *jcr, const char *name) } break; } + free_pool_memory(ecmd); return true; bail_out: + free_pool_memory(ecmd); /* cancel running job properly */ if (fail_on_error) { jcr->setJobStatus(JS_ErrorTerminated);