mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-28 07:13:34 +00:00
perf sort: Fix a memory leak on srcline
In the hist_entry__srcline_snprintf(), path and self->srcline are pointing the same memory region, but they are doubly allocated. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Reviewed-by: Jiri Olsa <jolsa@redhat.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1378876173-13363-2-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
fc67297b16
commit
963ba5fd5d
1 changed files with 1 additions and 4 deletions
|
@ -269,10 +269,7 @@ static int hist_entry__srcline_snprintf(struct hist_entry *self, char *bf,
|
|||
if (!fp)
|
||||
goto out_ip;
|
||||
|
||||
if (getline(&path, &line_len, fp) < 0 || !line_len)
|
||||
goto out_ip;
|
||||
self->srcline = strdup(path);
|
||||
if (self->srcline == NULL)
|
||||
if (getline(&self->srcline, &line_len, fp) < 0 || !line_len)
|
||||
goto out_ip;
|
||||
|
||||
nl = strchr(self->srcline, '\n');
|
||||
|
|
Loading…
Reference in a new issue