diff --git a/src/tools.c b/src/tools.c index cdd9cbe5f..741622fa6 100644 --- a/src/tools.c +++ b/src/tools.c @@ -7562,6 +7562,13 @@ int backup_env(void) if (*tmp == NULL) { ha_alert("Cannot allocate memory to backup env variable '%s'.\n", *env); + tmp = init_env; + while (*tmp) { + free(*tmp); + tmp++; + } + free(init_env); + init_env = NULL; return -1; } tmp++;