From: Andrea Claudi Date: Mon, 19 Apr 2021 13:36:57 +0000 (+0200) Subject: tc: e_bpf: fix memory leak in parse_bpf() X-Git-Tag: v5.12.0~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=932fe3453f39503b5689912d7e0b01ac2b03e7a0;p=thirdparty%2Fiproute2.git tc: e_bpf: fix memory leak in parse_bpf() envp_run is dinamically allocated with a malloc, and not freed in the out: return path. This commit fix it. Signed-off-by: Andrea Claudi Signed-off-by: Stephen Hemminger --- diff --git a/tc/e_bpf.c b/tc/e_bpf.c index a48393b74..517ee5b35 100644 --- a/tc/e_bpf.c +++ b/tc/e_bpf.c @@ -159,7 +159,9 @@ static int parse_bpf(struct exec_util *eu, int argc, char **argv) envp_run[env_num - 1] = NULL; out: - return execvpe(argv_run[0], argv_run, envp_run); + ret = execvpe(argv_run[0], argv_run, envp_run); + free(envp_run); + return ret; err_free_env: for (--i; i >= env_old; i--)