[master] 0d77366e4 varnishd: Plug irrelevant leak in VPI_Vmod_Init()
Nils Goroll
nils.goroll at uplex.de
Fri Sep 6 11:53:10 UTC 2024
commit 0d77366e42a57d7dcb1f79b7886c552f99e9b604
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Fri Sep 6 13:51:23 2024 +0200
varnishd: Plug irrelevant leak in VPI_Vmod_Init()
for error cases, we would leak the memory allocated for v->backup
diff --git a/bin/varnishd/cache/cache_vrt_vmod.c b/bin/varnishd/cache/cache_vrt_vmod.c
index 8a088a19d..c1fa22070 100644
--- a/bin/varnishd/cache/cache_vrt_vmod.c
+++ b/bin/varnishd/cache/cache_vrt_vmod.c
@@ -109,7 +109,6 @@ VPI_Vmod_Init(VRT_CTX, struct vmod **hdl, unsigned nbr, void *ptr, int len,
if (v == NULL) {
ALLOC_OBJ(v, VMOD_MAGIC);
AN(v);
- REPLACE(v->backup, backup);
v->hdl = dlhdl;
@@ -151,6 +150,7 @@ VPI_Vmod_Init(VRT_CTX, struct vmod **hdl, unsigned nbr, void *ptr, int len,
REPLACE(v->nm, nm);
REPLACE(v->path, path);
+ REPLACE(v->backup, backup);
VSC_C_main->vmods++;
VTAILQ_INSERT_TAIL(&vmods, v, list);
More information about the varnish-commit
mailing list