[master] cf20e04 plug minor leaks reported by coverity
Nils Goroll
nils.goroll at uplex.de
Sat May 5 08:26:22 UTC 2018
commit cf20e04efa007be1632c9f137338203f9691d25a
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 a37ddf3..32779a9 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 08977af..b0efed5 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