Replace bare realloc() calls with my_realloc2(), which frees the original
pointer on allocation failure, preventing a memory leak when the pointer
is subsequently overwritten with NULL.
Must be backported to 3.2.
/* copy the array of domain strings */
while (src->conf.acme.domains[n]) {
- r = realloc(r, sizeof(char *) * (n + 2));
+ r = my_realloc2(r, sizeof(char *) * (n + 2));
if (!r)
goto error;
do {
while (*e != ',' && *e != '\0')
e++;
- r = realloc(r, sizeof(char *) * (n + 2));
+ r = my_realloc2(r, sizeof(char *) * (n + 2));
if (!r) {
ha_alert("parsing [%s:%d]: out of memory.\n", file, linenum);
err_code |= ERR_ALERT | ERR_ABORT;