aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSohaib Mohamed <[email protected]>2021-11-10 04:20:11 +0200
committerArnaldo Carvalho de Melo <[email protected]>2021-11-18 10:08:07 -0300
commit92723ea0f11d92496687db8c9725248e9d1e5e1d (patch)
tree1ab54ca0cda66679b4b408325ecf07f9849efd59
parentcb5a63feae2d963cac7b687e6598d620bed13507 (diff)
perf bench: Fix two memory leaks detected with ASan
ASan reports memory leaks while running: $ perf bench sched all Fixes: e27454cc6352c422 ("perf bench: Add sched-messaging.c: Benchmark for scheduler and IPC mechanisms based on hackbench") Signed-off-by: Sohaib Mohamed <[email protected]> Acked-by: Ian Rogers <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Hitoshi Mitake <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Russel <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Pierre Gondois <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r--tools/perf/bench/sched-messaging.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/perf/bench/sched-messaging.c b/tools/perf/bench/sched-messaging.c
index 488f6e6ba1a5..fa0ff4ce2b74 100644
--- a/tools/perf/bench/sched-messaging.c
+++ b/tools/perf/bench/sched-messaging.c
@@ -223,6 +223,8 @@ static unsigned int group(pthread_t *pth,
snd_ctx->out_fds[i] = fds[1];
if (!thread_mode)
close(fds[0]);
+
+ free(ctx);
}
/* Now we have all the fds, fork the senders */
@@ -239,6 +241,8 @@ static unsigned int group(pthread_t *pth,
for (i = 0; i < num_fds; i++)
close(snd_ctx->out_fds[i]);
+ free(snd_ctx);
+
/* Return number of children to reap */
return num_fds * 2;
}