[4.1] 6dca7ae Only grab the reference count if we need it.

Martin Blix Grydeland martin at varnish-software.com
Thu Mar 3 10:52:53 CET 2016


commit 6dca7aecb0c57402e5f8def400676ddeed72cd24
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 aea88e5..deb4255 100644
--- a/bin/varnishd/cache/cache_ban.c
+++ b/bin/varnishd/cache/cache_ban.c
@@ -525,7 +525,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