[master] 9f5dc5cc3 Plug insignificant vcc leaks
Nils Goroll
nils.goroll at uplex.de
Sun Jan 3 14:03:09 UTC 2021
commit 9f5dc5cc3f7b888211db0c3a8661a21173dab0c0
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Sun Jan 3 14:31:25 2021 +0100
Plug insignificant vcc leaks
Ref Coverity CIDs 1362617, 1362618, 1362624, 1362626
diff --git a/lib/libvcc/vcc_acl.c b/lib/libvcc/vcc_acl.c
index 47c0b4ef2..6bfc553b2 100644
--- a/lib/libvcc/vcc_acl.c
+++ b/lib/libvcc/vcc_acl.c
@@ -200,6 +200,7 @@ vcc_acl_add_entry(struct vcc *tl, const struct acl_e *ae, int l,
vcc_ErrWhere(tl, ae2->t_addr);
VSB_cat(tl->sb, "vs:\n");
vcc_ErrWhere(tl, aen->t_addr);
+ free(aen);
return;
}
/*
@@ -387,12 +388,14 @@ vcc_acl_entry(struct vcc *tl)
if (*e != '\0') {
VSB_cat(tl->sb, ".../mask is not numeric.\n");
vcc_ErrWhere(tl, ae->t_addr);
+ free(ae);
return;
}
ae->t_mask = ae->t_addr;
if (tl->t->tok == '/') {
VSB_cat(tl->sb, "/mask only allowed once.\n");
vcc_ErrWhere(tl, tl->t);
+ free(ae);
return;
}
} else if (tl->t->tok == '/') {
diff --git a/lib/libvcc/vcc_backend.c b/lib/libvcc/vcc_backend.c
index 4a88eeb8b..a31cb901e 100644
--- a/lib/libvcc/vcc_backend.c
+++ b/lib/libvcc/vcc_backend.c
@@ -261,6 +261,7 @@ vcc_ParseProbeSpec(struct vcc *tl, const struct symbol *sym, char **name)
SkipToken(tl, ';');
}
+ free(fs);
if (t_threshold != NULL || t_window != NULL) {
if (t_threshold == NULL && t_window != NULL) {
@@ -353,20 +354,6 @@ vcc_ParseHostDef(struct vcc *tl, const struct token *t_be, const char *vgcname)
unsigned u;
double t;
- fs = vcc_FldSpec(tl,
- "?host",
- "?port",
- "?path",
- "?host_header",
- "?connect_timeout",
- "?first_byte_timeout",
- "?between_bytes_timeout",
- "?probe",
- "?max_connections",
- "?proxy_header",
- NULL);
-
-
if (tl->t->tok == ID &&
(vcc_IdIs(tl->t, "none") || vcc_IdIs(tl->t, "None"))) {
vcc_NextToken(tl);
@@ -391,6 +378,19 @@ vcc_ParseHostDef(struct vcc *tl, const struct token *t_be, const char *vgcname)
return;
}
+ fs = vcc_FldSpec(tl,
+ "?host",
+ "?port",
+ "?path",
+ "?host_header",
+ "?connect_timeout",
+ "?first_byte_timeout",
+ "?between_bytes_timeout",
+ "?probe",
+ "?max_connections",
+ "?proxy_header",
+ NULL);
+
tl->fb = VSB_new_auto();
AN(tl->fb);
@@ -512,6 +512,7 @@ vcc_ParseHostDef(struct vcc *tl, const struct token *t_be, const char *vgcname)
}
vcc_FieldsOk(tl, fs);
+ free(fs);
ERRCHK(tl);
ExpectErr(tl, '}');
More information about the varnish-commit
mailing list