From: Willy Tarreau Date: Sun, 5 Nov 2017 09:35:57 +0000 (+0100) Subject: BUG/MAJOR: threads/dns: add missing unlock on allocation failure path X-Git-Tag: v1.8-rc3~64 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5ec84574c761c883c0a7d768c417c3278c2c97d9;p=thirdparty%2Fhaproxy.git BUG/MAJOR: threads/dns: add missing unlock on allocation failure path An unlock was missing when a memory allocation failure is detected. --- diff --git a/src/dns.c b/src/dns.c index c1f3beef50..6b87460908 100644 --- 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; }