]> err.no Git - varnish/commitdiff
Part of this commit sneaked into the previous #1985:
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sun, 23 Sep 2007 13:09:56 +0000 (13:09 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sun, 23 Sep 2007 13:09:56 +0000 (13:09 +0000)
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

index ec8d6077735e06c521fff03d3f38dc4c9079a542..ec40d08782a6ea82e73c152a3e9d3de898f17e80 100644 (file)
@@ -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) {