]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: ssl: fix memory leak on realloc failure in acme.ips
authorBiancaDogareci <biancadogareci@ymail.com>
Sat, 25 Apr 2026 12:00:37 +0000 (15:00 +0300)
committerWilliam Lallemand <wlallemand@irq6.net>
Sat, 25 Apr 2026 14:12:25 +0000 (16:12 +0200)
Fix a realloc() bug in ckchs_dup() when copying the acme.ips array,
where overwriting the original pointer with NULL on allocation failure
loses reference to the original memory block.

Use my_realloc2() which safely handles the failure.

No backport needed.

src/ssl_ckch.c

index 75392a6c2cc895c5eb0058af89ca58879b224abd..04d7a302f1e2097be5acc18b6a99b46a85f34f86 100644 (file)
@@ -1119,7 +1119,7 @@ struct ckch_store *ckchs_dup(const struct ckch_store *src)
                /* copy the array of IP strings */
 
                while (src->conf.acme.ips[n]) {
-                       r = realloc(r, sizeof(char *) * (n + 2));
+                       r = my_realloc2(r, sizeof(char *) * (n + 2));
                        if (!r)
                                goto error;