[6.0] e401850c6 Assert priv is not null before dereferencing it

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Wed Jul 10 07:42:09 UTC 2019


commit e401850c6f89d0f6c1870a1d00e9141c3272dbb1
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 10b9021c4..1a1de05be 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