Skip to content

Commit

Permalink
perf tools: Fix memory leak on error
Browse files Browse the repository at this point in the history
cppcheck reported:
[util/event.c:480]: (error) Memory leak: event

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
Link: http://lkml.kernel.org/r/2717013.8dV0naNhAV@storm
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Thomas Jarosch authored and Arnaldo Carvalho de Melo committed Jan 30, 2013
1 parent 8eb44dd commit 0b9e01a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/perf/util/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,10 @@ int perf_event__synthesize_kernel_mmap(struct perf_tool *tool,
}
}

if (kallsyms__parse(filename, &args, find_symbol_cb) <= 0)
if (kallsyms__parse(filename, &args, find_symbol_cb) <= 0) {
free(event);
return -ENOENT;
}

map = machine->vmlinux_maps[MAP__FUNCTION];
size = snprintf(event->mmap.filename, sizeof(event->mmap.filename),
Expand Down

0 comments on commit 0b9e01a

Please sign in to comment.