[master] 0e32f1667 Fix WS_Reserve() error handling

Nils Goroll nils.goroll at uplex.de
Sun Apr 7 15:59:06 UTC 2019


commit 0e32f1667ea55156fc2a7fa84e3f1080a05bcb2e
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Sun Apr 7 17:32:48 2019 +0200

    Fix WS_Reserve() error handling
    
    See #2967 for discussion

diff --git a/bin/varnishd/http2/cache_http2_deliver.c b/bin/varnishd/http2/cache_http2_deliver.c
index 7ee71ac99..5a3d01cab 100644
--- a/bin/varnishd/http2/cache_http2_deliver.c
+++ b/bin/varnishd/http2/cache_http2_deliver.c
@@ -226,8 +226,10 @@ h2_build_headers(struct vsb *resp, struct req *req)
 	ssize_t sz, sz1;
 
 	l = WS_Reserve(req->ws, 0);
-	if (l < 10)
+	if (l < 10) {
+		WS_Release(req->ws, 0);
 		return (-1);
+	}
 
 	AN(VSB_new(resp, req->ws->f, l, VSB_FIXEDLEN));
 


More information about the varnish-commit mailing list