]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
tc: e_bpf: fix memory leak in parse_bpf()
authorAndrea Claudi <aclaudi@redhat.com>
Mon, 19 Apr 2021 13:36:57 +0000 (15:36 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Tue, 27 Apr 2021 04:05:19 +0000 (21:05 -0700)
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>
tc/e_bpf.c

index a48393b74df64fb5614f78f5bd851c5c12f4c779..517ee5b35734d8a417a83eb104edd363973cfe4a 100644 (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--)