From db42a027ee55c0487454f2f82c6839196120e248 Mon Sep 17 00:00:00 2001 From: phk Date: Sat, 22 Jul 2006 22:01:04 +0000 Subject: [PATCH] reorg a little bit. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@566 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/hash_classic.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/varnish-cache/bin/varnishd/hash_classic.c b/varnish-cache/bin/varnishd/hash_classic.c index b25931de..5c836e5e 100644 --- a/varnish-cache/bin/varnishd/hash_classic.c +++ b/varnish-cache/bin/varnishd/hash_classic.c @@ -177,16 +177,16 @@ hcl_deref(struct objhead *oh) CAST_OBJ_NOTNULL(he, oh->hashpriv, HCL_ENTRY_MAGIC); mtx = he->mtx; AZ(pthread_mutex_lock(&hcl_mutex[mtx])); - if (--he->refcnt == 0) { - free(he->key1); - free(he->key2); - TAILQ_REMOVE(&hcl_head[he->hash], he, list); - free(he); - ret = 0; - } else - ret = 1; + if (--he->refcnt >= 0) { + AZ(pthread_mutex_unlock(&hcl_mutex[mtx])); + return (1) + } + TAILQ_REMOVE(&hcl_head[he->hash], he, list); AZ(pthread_mutex_unlock(&hcl_mutex[mtx])); - return (ret); + free(he->key1); + free(he->key2); + free(he); + return (0); } /*--------------------------------------------------------------------*/ -- 2.39.5