[6.0] 861085142 plug minor leaks reported by coverity

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Aug 16 08:52:55 UTC 2018


commit 86108514270a4cef7fc9d40a2e7b9ad15dd805c1
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Sat May 5 10:17:56 2018 +0200

    plug minor leaks reported by coverity

diff --git a/bin/varnishd/storage/mgt_stevedore.c b/bin/varnishd/storage/mgt_stevedore.c
index a37ddf335..32779a9c6 100644
--- a/bin/varnishd/storage/mgt_stevedore.c
+++ b/bin/varnishd/storage/mgt_stevedore.c
@@ -189,12 +189,12 @@ STV_Config(const char *spec)
 	*stv = *stv2;
 	AN(stv->name);
 
-	if (name == NULL) {
+	if (name) {
+		stv->ident = name;
+	} else {
 		bprintf(buf, "s%u", seq++);
-		name = buf;
+		stv->ident = strdup(buf);
 	}
-
-	stv->ident = strdup(name);
 	AN(stv->ident);
 	stv_check_ident(spec, stv->ident);
 
diff --git a/lib/libvcc/vcc_expr.c b/lib/libvcc/vcc_expr.c
index 08977af28..b0efed5e3 100644
--- a/lib/libvcc/vcc_expr.c
+++ b/lib/libvcc/vcc_expr.c
@@ -300,6 +300,7 @@ vcc_Eval_Regsub(struct vcc *tl, struct expr **e, struct token *t,
 	ExpectErr(tl, CSTR);
 	p = vcc_regexp(tl);
 	bprintf(buf, "VRT_regsub(ctx, %d,\v+\n\v1,\n%s", all, p);
+	free(TRUST_ME(p));
 	*e = vcc_expr_edit(tl, STRING, buf, e2, NULL);
 	SkipToken(tl, ',');
 	vcc_expr0(tl, &e2, STRING);
@@ -990,6 +991,7 @@ cmp_regexp(struct vcc *tl, struct expr **e, const struct cmps *cp)
 	re = vcc_regexp(tl);
 	ERRCHK(tl);
 	bprintf(buf, "%sVRT_re_match(ctx, \v1, %s)", cp->emit, re);
+	free(TRUST_ME(re));
 	*e = vcc_expr_edit(tl, BOOL, buf, *e, NULL);
 }
 


More information about the varnish-commit mailing list