BUG/MINOR: mworker: fix a memleak when execvp() failed
authorWilliam Lallemand <wlallemand@haproxy.com>
Mon, 8 Jun 2020 08:01:13 +0000 (10:01 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Mon, 8 Jun 2020 08:19:33 +0000 (10:19 +0200)
Free next_argv when execvp() failed.

Must be backported as far as 1.8.

Should fix issue #668.

(cherry picked from commit 9fc6c97fb30bb9c15d6b6e34c917b0b5aba7486a)
Signed-off-by: William Lallemand <wlallemand@haproxy.org>

src/haproxy.c

index d97c1f3..42f898f 100644 (file)
@@ -853,6 +853,8 @@ void mworker_reload()
        execvp(next_argv[0], next_argv);
 
        ha_warning("Failed to reexecute the master process [%d]: %s\n", pid, strerror(errno));
+       free(next_argv);
+       next_argv = NULL;
        return;
 
 alloc_error: