]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: dns: fix ring attach control on dns_session_new
authorEmeric Brun <ebrun@haproxy.com>
Mon, 15 Feb 2021 14:13:31 +0000 (15:13 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 15 Feb 2021 14:24:28 +0000 (15:24 +0100)
Ths patch adds a control on ring_attach which can not currently fail
since we are the first to try to attach.

This should fix issue #1126

src/dns.c

index 9e44dd6c4ac37674a1e6e1a40b4ef0ff40b95f8d..58c68d75bf76e619af98df06b6c3142d2080e004 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -1033,7 +1033,13 @@ struct dns_session *dns_session_new(struct dns_stream_server *dss)
                goto error;
 
        ring_init(&ds->ring, ds->tx_ring_area, DNS_TCP_MSG_RING_MAX_SIZE);
-       ring_attach(&ds->ring);
+       if (!ring_attach(&ds->ring)) {
+               /* Should never happen
+                * since we are the first attached
+                * here
+                */
+               goto error;
+       }
 
        if ((ds->task_exp = task_new(tid_bit)) == NULL)
                goto error;