Skip to content

Commit

Permalink
perf record: Fix memory leak on AIO objects deallocation
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alexey Budankov authored and Arnaldo Carvalho de Melo committed Dec 17, 2018
1 parent 91b2b97 commit c8dd6ee
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tools/perf/util/mmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,14 @@ static int perf_mmap__aio_mmap(struct perf_mmap *map, struct mmap_params *mp)

static void perf_mmap__aio_munmap(struct perf_mmap *map)
{
int i;

for (i = 0; i < map->aio.nr_cblocks; ++i)
zfree(&map->aio.data[i]);
if (map->aio.data)
zfree(&map->aio.data);
zfree(&map->aio.cblocks);
zfree(&map->aio.aiocb);
}

int perf_mmap__aio_push(struct perf_mmap *md, void *to, int idx,
Expand Down

0 comments on commit c8dd6ee

Please sign in to comment.