[master] 9f8a3cf4a vcl: Centralize struct vcldir tear down
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Thu May 6 17:31:05 UTC 2021
commit 9f8a3cf4af9114114ccdfc6af2e3ab7611cad251
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Thu May 6 19:26:21 2021 +0200
vcl: Centralize struct vcldir tear down
And doing so plug the director lock leak spotted by asan.
Refs 47586588fccde1869a8bec76001406fc6ebb0b84
Refs 6e9b8d6d7ca93d365914c044307fab455d4ec750
diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index 2ecbc8c3c..d70e9543f 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -457,11 +457,9 @@ vcl_KillBackends(struct vcl *vcl)
if (vdir == NULL)
break;
VTAILQ_REMOVE(&vcl->director_list, vdir, list);
- REPLACE(vdir->cli_name, NULL);
AN(vdir->methods->destroy);
vdir->methods->destroy(vdir->dir);
- FREE_OBJ(vdir->dir);
- FREE_OBJ(vdir);
+ vcldir_free(vdir);
}
Lck_Unlock(&vcl_mtx);
}
diff --git a/bin/varnishd/cache/cache_vcl.h b/bin/varnishd/cache/cache_vcl.h
index 885e918a8..0c72c22ec 100644
--- a/bin/varnishd/cache/cache_vcl.h
+++ b/bin/varnishd/cache/cache_vcl.h
@@ -71,6 +71,7 @@ extern struct lock vcl_mtx;
extern struct vcl *vcl_active; /* protected by vcl_mtx */
struct vcl *vcl_find(const char *);
void VCL_Update(struct vcl **, struct vcl *);
+void vcldir_free(struct vcldir *);
struct vcltemp {
const char * const name;
diff --git a/bin/varnishd/cache/cache_vrt_vcl.c b/bin/varnishd/cache/cache_vrt_vcl.c
index 9dcd5a55b..9b3c25a0f 100644
--- a/bin/varnishd/cache/cache_vrt_vcl.c
+++ b/bin/varnishd/cache/cache_vrt_vcl.c
@@ -138,7 +138,7 @@ VCL_Rel(struct vcl **vcc)
/*--------------------------------------------------------------------*/
-static void
+void
vcldir_free(struct vcldir *vdir)
{
More information about the varnish-commit
mailing list