[master] d8421dcd5 Assert priv is not null before dereferencing it

Nils Goroll nils.goroll at uplex.de
Wed Apr 24 11:41:08 UTC 2019


commit d8421dcd59a8cf271e4587a0228a3a24954636f2
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Wed Apr 17 18:56:30 2019 +0200

    Assert priv is not null before dereferencing it
    
    And make it clear that we steal the reference at this point.

diff --git a/bin/varnishd/http2/cache_http2_deliver.c b/bin/varnishd/http2/cache_http2_deliver.c
index 26e4cc5da..d5febbf38 100644
--- a/bin/varnishd/http2/cache_http2_deliver.c
+++ b/bin/varnishd/http2/cache_http2_deliver.c
@@ -86,11 +86,10 @@ h2_fini(struct req *req, void **priv)
 	struct h2_req *r2;
 
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
-	CAST_OBJ_NOTNULL(r2, *priv, H2_REQ_MAGIC);
+	TAKE_OBJ_NOTNULL(r2, priv, H2_REQ_MAGIC);
 	H2_Send_Get(req->wrk, r2->h2sess, r2);
 	H2_Send(req->wrk, r2, H2_F_DATA, H2FF_DATA_END_STREAM, 0, "");
 	H2_Send_Rel(r2->h2sess, r2);
-	*priv = NULL;
 	return (0);
 }
 


More information about the varnish-commit mailing list