Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <alexey.budankov@linux.intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/e5d3154e-1583-83bb-9527-28ddbc6dbf9d@linux.intel.com
[ No need to test for NULL before calling zfree() ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Alexey Budankov and committed by
Arnaldo Carvalho de Melo
c8dd6ee5 91b2b970

+6
+6
tools/perf/util/mmap.c
··· 207 207 208 208 static void perf_mmap__aio_munmap(struct perf_mmap *map) 209 209 { 210 + int i; 211 + 212 + for (i = 0; i < map->aio.nr_cblocks; ++i) 213 + zfree(&map->aio.data[i]); 210 214 if (map->aio.data) 211 215 zfree(&map->aio.data); 216 + zfree(&map->aio.cblocks); 217 + zfree(&map->aio.aiocb); 212 218 } 213 219 214 220 int perf_mmap__aio_push(struct perf_mmap *md, void *to, int idx,