[master] bca23a016 re-apply tools/coccinelle/free_obj.cocci

Nils Goroll nils.goroll at uplex.de
Tue Feb 9 16:15:09 UTC 2021


commit bca23a0160b1d09daa9ed4a6bf045d7f4223cd14
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Tue Feb 9 17:01:44 2021 +0100

    re-apply tools/coccinelle/free_obj.cocci
    
    Missing include for REPLACE() / memset() added manually.

diff --git a/bin/varnishd/cache/cache_conn_pool.c b/bin/varnishd/cache/cache_conn_pool.c
index 23b8d4912..21fcab862 100644
--- a/bin/varnishd/cache/cache_conn_pool.c
+++ b/bin/varnishd/cache/cache_conn_pool.c
@@ -247,7 +247,7 @@ VCP_Rel(struct conn_pool **cpp)
 	AZ(cp->n_conn);
 	AZ(cp->n_kill);
 	free(cp->endpoint);
-	free(cp);
+	FREE_OBJ(cp);
 }
 
 /*--------------------------------------------------------------------
diff --git a/bin/varnishd/storage/storage_malloc.c b/bin/varnishd/storage/storage_malloc.c
index b04f7bf64..ec99c1738 100644
--- a/bin/varnishd/storage/storage_malloc.c
+++ b/bin/varnishd/storage/storage_malloc.c
@@ -150,7 +150,7 @@ sma_free(struct storage *s)
 		sma_sc->stats->g_space += sma->sz;
 	Lck_Unlock(&sma_sc->sma_mtx);
 	free(sma->s.ptr);
-	free(sma);
+	FREE_OBJ(sma);
 }
 
 static VCL_BYTES v_matchproto_(stv_var_used_space)
diff --git a/lib/libvarnish/vbh.c b/lib/libvarnish/vbh.c
index b8417eb87..073de5e0a 100644
--- a/lib/libvarnish/vbh.c
+++ b/lib/libvarnish/vbh.c
@@ -41,6 +41,7 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <string.h>
 
 #include "miniobj.h"
 #include "vdef.h"
@@ -256,7 +257,7 @@ VBH_destroy(struct vbh **bhp)
 	for (u = 0; u < bh->length; u += ROW_WIDTH)
 		free(ROW(bh, u));
 	free(bh->array);
-	free(bh);
+	FREE_OBJ(bh);
 }
 
 static void


More information about the varnish-commit mailing list