]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: dns: fix memory leak of sockaddr in dns_session_init() error path
authorWilly Tarreau <w@1wt.eu>
Thu, 14 May 2026 20:58:46 +0000 (20:58 +0000)
committerWilly Tarreau <w@1wt.eu>
Fri, 15 May 2026 13:40:29 +0000 (15:40 +0200)
In dns_session_init(), sockaddr_alloc() allocates 'addr' from the sockaddr
pool, but on failure of appctx_finalize_startup() we jump to the error label
without calling sockaddr_free(&addr), leaking the allocation. Let's add the
missing sockaddr_free() on the error branch.

This must be backported to 2.6.

src/dns.c

index 58a1b3608d04f26c5de541f50eaad1c236e6e537..970db6e43f6f2ea7ef58561be3b32d76c28b88c0 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -913,6 +913,7 @@ static int dns_session_init(struct appctx *appctx)
        return 0;
 
   error:
+       sockaddr_free(&addr);
        return -1;
 }