[master] 70ec0a5 Fix two resource leaks found by Coverity, both insignificant and both introduced yesterday.

Poul-Henning Kamp phk at FreeBSD.org
Thu Feb 12 09:29:41 CET 2015


commit 70ec0a57d6d696bc3be771056fbb428e1c47b27c
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Feb 12 08:28:37 2015 +0000

    Fix two resource leaks found by Coverity, both insignificant and
    both introduced yesterday.

diff --git a/bin/varnishd/mgt/mgt_vcc.c b/bin/varnishd/mgt/mgt_vcc.c
index d6ddc30..34be631 100644
--- a/bin/varnishd/mgt/mgt_vcc.c
+++ b/bin/varnishd/mgt/mgt_vcc.c
@@ -323,6 +323,7 @@ mgt_vcc_compile(struct vcc_priv *vp, struct vsb *sb, int C_flag)
 		csrc = VFIL_readfile(NULL, vp->srcfile, NULL);
 		AN(csrc);
 		VSB_cat(sb, csrc);
+		free(csrc);
 	}
 
 	subs = VSUB_run(sb, run_cc, vp, "C-compiler", 10);
@@ -395,10 +396,12 @@ mgt_VccCompile(struct cli *cli, const char *vclname, const char *vclsrc,
 	    "vcl.load %s %s\n", vclname, vp.libfile)) {
 		mgt_vcc_add(vclname, vp.libfile);
 		free(vp.libfile);
+		free(p);
 		return;
 	}
 
 	VCLI_Out(cli, "%s", p);
+	free(p);
 	VCLI_SetResult(cli, CLIS_PARAM);
 	(void)unlink(vp.libfile);
 	free(vp.libfile);



More information about the varnish-commit mailing list