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 <aclaudi@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Andrea Claudi 2021-04-19 15:36:57 +02:00 committed by Stephen Hemminger
parent 38ef5bb7b4
commit 932fe3453f
1 changed files with 3 additions and 1 deletions

View File

@ -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--)