[<prev] [next>] [day] [month] [year] [list]
Message-Id: <61ec0f2e5054f0d98fe870b5ce995b9b82a09ff4.1618839246.git.aclaudi@redhat.com>
Date: Mon, 19 Apr 2021 15:36:57 +0200
From: Andrea Claudi <aclaudi@...hat.com>
To: netdev@...r.kernel.org
Cc: stephen@...workplumber.org, dsahern@...il.com
Subject: [PATCH iproute2] 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@...hat.com>
---
tc/e_bpf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tc/e_bpf.c b/tc/e_bpf.c
index a48393b7..517ee5b3 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--)
--
2.30.2
Powered by blists - more mailing lists