BUG/MINOR: ssl: fix memory leak on realloc failure in acme.ips
Some checks failed
Contrib / admin/halog/ (push) Has been cancelled
Contrib / dev/flags/ (push) Has been cancelled
Contrib / dev/haring/ (push) Has been cancelled
Contrib / dev/hpack/ (push) Has been cancelled
Contrib / dev/poll/ (push) Has been cancelled
VTest / Generate Build Matrix (push) Has been cancelled
Windows / Windows, gcc, all features (push) Has been cancelled
VTest / (push) Has been cancelled

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.
This commit is contained in:
BiancaDogareci 2026-04-25 15:00:37 +03:00 committed by William Lallemand
parent 90bfbea7c0
commit fa17a50c62

View 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;