]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MAJOR: threads/dns: add missing unlock on allocation failure path
authorWilly Tarreau <w@1wt.eu>
Sun, 5 Nov 2017 09:35:57 +0000 (10:35 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 5 Nov 2017 09:35:57 +0000 (10:35 +0100)
An unlock was missing when a memory allocation failure is detected.

src/dns.c

index c1f3beef5067bd845989da154ea0a5ffef7bee3d..6b87460908452e7958f4283b5bee443107066491 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -1347,8 +1347,10 @@ int dns_link_resolution(void *requester, int requester_type)
        if (srv) {
                SPIN_LOCK(SERVER_LOCK, &srv->lock);
                if (srv->dns_requester == NULL) {
-                       if ((req = calloc(1, sizeof(*req))) == NULL)
+                       if ((req = calloc(1, sizeof(*req))) == NULL) {
+                               SPIN_UNLOCK(SERVER_LOCK, &srv->lock);
                                goto err;
+                       }
                        req->owner         = &srv->obj_type;
                        srv->dns_requester = req;
                }