From fa769bec514f35c1677cc0dd8697a202cd8dc160 Mon Sep 17 00:00:00 2001 From: phk Date: Sun, 23 Sep 2007 13:09:56 +0000 Subject: [PATCH] Part of this commit sneaked into the previous #1985: Close a supposedly rare memory leak: when we loose the race to create an objhead, we need to free the hash-string we created before our second attempt. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1990 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/hash_classic.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/varnish-cache/bin/varnishd/hash_classic.c b/varnish-cache/bin/varnishd/hash_classic.c index ec8d6077..ec40d087 100644 --- a/varnish-cache/bin/varnishd/hash_classic.c +++ b/varnish-cache/bin/varnishd/hash_classic.c @@ -161,6 +161,10 @@ hcl_lookup(struct sess *sp, struct objhead *noh) he->refcnt++; roh = he->oh; UNLOCK(&hp->mtx); + /* + * If we loose the race, we need to clean up + * the work we did for our second attempt. + */ if (he2 != NULL) free(he2); if (noh->hash != NULL) { -- 2.39.5