[4.1] 26d5261 Fix memory leak of vary string on stevedore alloc fail
PÃ¥l Hermunn Johansen
hermunn at varnish-software.com
Tue Apr 24 09:58:17 UTC 2018
commit 26d52615004730eb28ce603930600d44cafd8202
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date: Wed Mar 14 13:52:36 2018 +0100
Fix memory leak of vary string on stevedore alloc fail
If the stevedore failed the object creation, we would leak the temporary
VSB holding the computed vary string. This patch frees it.
Problem exists in 4.1 and later.
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index b356828..902ad17 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -125,8 +125,12 @@ vbf_beresp2obj(struct busyobj *bo)
if (bo->uncacheable)
bo->fetch_objcore->flags |= OC_F_PASS;
- if (!vbf_allocobj(bo, l))
+ if (!vbf_allocobj(bo, l)) {
+ if (vary != NULL)
+ VSB_destroy(&vary);
+ AZ(vary);
return (-1);
+ }
if (vary != NULL) {
b = ObjSetattr(bo->wrk, bo->fetch_objcore, OA_VARY, varyl,
More information about the varnish-commit
mailing list