[master] c461c05 Only grab the reference count if we need it.

Poul-Henning Kamp phk at FreeBSD.org
Tue Mar 1 22:59:25 CET 2016


commit c461c0534af077c0a10abebb1b2c812ce2baf22d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Mar 1 21:59:07 2016 +0000

    Only grab the reference count if we need it.
    
    Spotted by:	Martin

diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c
index 490dbf8..fb4a5a4 100644
--- a/bin/varnishd/cache/cache_ban.c
+++ b/bin/varnishd/cache/cache_ban.c
@@ -546,7 +546,8 @@ BAN_CheckObject(struct worker *wrk, struct objcore *oc, struct req *req)
 	Lck_Lock(&ban_mtx);
 	b0 = ban_start;
 	bn = oc->ban;
-	bn->refcount++;
+	if (b0 != bn)
+		bn->refcount++;
 	Lck_Unlock(&ban_mtx);
 
 	AN(bn);



More information about the varnish-commit mailing list