aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/sort.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2013-09-11 14:09:25 +0900
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-10-09 15:58:07 -0300
commit963ba5fd5d04f36d6a5c9a94562484a4f270c1de (patch)
tree7970c09c4fb24df64764776a7223d39aaeac5554 /tools/perf/util/sort.c
parentperf tools: Separate out GTK codes to libperf-gtk.so (diff)
downloadlinux-dev-963ba5fd5d04f36d6a5c9a94562484a4f270c1de.tar.xz
linux-dev-963ba5fd5d04f36d6a5c9a94562484a4f270c1de.zip
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>
Diffstat (limited to '')
-rw-r--r--tools/perf/util/sort.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index b4ecc0e4c908..97cf3ef4417c 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -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');