Skip to content

Commit c8dd6ee

Browse files
Alexey Budankovacmel
authored andcommitted
perf record: Fix memory leak on AIO objects deallocation
Sending a part which was missed between v12 and v13 of the patch set introducing AIO trace streaming for perf record mode. The part is essential to avoid memory leakage during deallocation of AIO related trace data buffers. Signed-off-by: Alexey Budankov <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected] [ No need to test for NULL before calling zfree() ] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 91b2b97 commit c8dd6ee

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tools/perf/util/mmap.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,14 @@ static int perf_mmap__aio_mmap(struct perf_mmap *map, struct mmap_params *mp)
207207

208208
static void perf_mmap__aio_munmap(struct perf_mmap *map)
209209
{
210+
int i;
211+
212+
for (i = 0; i < map->aio.nr_cblocks; ++i)
213+
zfree(&map->aio.data[i]);
210214
if (map->aio.data)
211215
zfree(&map->aio.data);
216+
zfree(&map->aio.cblocks);
217+
zfree(&map->aio.aiocb);
212218
}
213219

214220
int perf_mmap__aio_push(struct perf_mmap *md, void *to, int idx,

0 commit comments

Comments
 (0)