[master] 35f574fb9 fix bad free of vsb on the stack

Nils Goroll nils.goroll at uplex.de
Mon Jan 20 10:21:05 UTC 2020


commit 35f574fb9fdae92812f64383bbfc26e2b3505437
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Mon Jan 20 11:17:14 2020 +0100

    fix bad free of vsb on the stack
    
    introduced with a74315bcebce9aae690e53847581e7f94033eff1
    
    spotted by coverity

diff --git a/bin/varnishd/proxy/cache_proxy_proto.c b/bin/varnishd/proxy/cache_proxy_proto.c
index 4a9d0e681..fb24fafdc 100644
--- a/bin/varnishd/proxy/cache_proxy_proto.c
+++ b/bin/varnishd/proxy/cache_proxy_proto.c
@@ -758,10 +758,8 @@ VPX_Send_Proxy(int fd, int version, const struct sess *sp)
 
 	r = write(fd, VSB_data(vsb), VSB_len(vsb));
 
-	if (!DO_DEBUG(DBG_PROTOCOL)) {
-		VSB_delete(vsb);
+	if (!DO_DEBUG(DBG_PROTOCOL))
 		return (r);
-	}
 
 	vsb2 = VSB_new_auto();
 	AN(vsb2);
@@ -769,7 +767,6 @@ VPX_Send_Proxy(int fd, int version, const struct sess *sp)
 	    version == 2 ? VSB_QUOTE_HEX : 0);
 	AZ(VSB_finish(vsb2));
 	VSL(SLT_Debug, 999, "PROXY_HDR %s", VSB_data(vsb2));
-	VSB_delete(vsb);
 	VSB_delete(vsb2);
 	return (r);
 }


More information about the varnish-commit mailing list