mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
perf bench: Fix two memory leaks detected with ASan
ASan reports memory leaks while running:
$ perf bench sched all
Fixes: e27454cc63
("perf bench: Add sched-messaging.c: Benchmark for scheduler and IPC mechanisms based on hackbench")
Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Hitoshi Mitake <h.mitake@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Russel <rusty@rustcorp.com.au>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Pierre Gondois <pierre.gondois@arm.com>
Link: http://lore.kernel.org/lkml/20211110022012.16620-1-sohaib.amhmd@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
cb5a63feae
commit
92723ea0f1
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user