From 5ec84574c761c883c0a7d768c417c3278c2c97d9 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sun, 5 Nov 2017 10:35:57 +0100 Subject: [PATCH] BUG/MAJOR: threads/dns: add missing unlock on allocation failure path An unlock was missing when a memory allocation failure is detected. --- src/dns.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dns.c b/src/dns.c index c1f3beef5..6b8746090 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; }