[master] d6a127b Fix memory leak of vary string on stevedore alloc fail
Martin Blix Grydeland
martin at varnish-software.com
Wed Mar 14 13:05:09 UTC 2018
commit d6a127b09ef6a241c20016e567a65a64a8af5ed4
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 f64cfb4..69dcfcc 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -129,8 +129,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) {
AN(ObjSetAttr(bo->wrk, bo->fetch_objcore, OA_VARY, varyl,
More information about the varnish-commit
mailing list