[master] 5dd19c0db Eliminate a memory leak in case of parameter errors. (Coverity)

Poul-Henning Kamp phk at FreeBSD.org
Mon Mar 29 09:22:04 UTC 2021


commit 5dd19c0dbeffc3c82e0963f31e733b061bb4be0c
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Mar 29 09:21:23 2021 +0000

    Eliminate a memory leak in case of parameter errors. (Coverity)

diff --git a/vmod/vmod_debug_acl.c b/vmod/vmod_debug_acl.c
index cb5fd3424..bff2a0ce2 100644
--- a/vmod/vmod_debug_acl.c
+++ b/vmod/vmod_debug_acl.c
@@ -162,9 +162,6 @@ xyzzy_sweep_acl(VRT_CTX, VCL_ACL acl, VCL_IP ip0, VCL_IP ip1, VCL_INT step)
 	struct vrt_blob *b;
 	ssize_t sz;
 
-	vsb = VSB_new_auto();
-	AN(vsb);
-
 	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
 	AN(acl);
 	AN(ip0);
@@ -172,6 +169,10 @@ xyzzy_sweep_acl(VRT_CTX, VCL_ACL acl, VCL_IP ip0, VCL_IP ip1, VCL_INT step)
 	assert(step > 0);
 	if (setup_sweep(ctx, asw, ip0, ip1, step))
 		return(NULL);
+
+	vsb = VSB_new_auto();
+	AN(vsb);
+
 	VSHA256_Init(vsha);
 	for (j = 0; ; j++) {
 		if ((j & 0x3f) == 0x00) {


More information about the varnish-commit mailing list