diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2013-09-11 14:09:25 +0900 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-10-09 15:58:07 -0300 |
commit | 963ba5fd5d04f36d6a5c9a94562484a4f270c1de (patch) | |
tree | 7970c09c4fb24df64764776a7223d39aaeac5554 /tools/perf | |
parent | fc67297b16da335d610af2fac96233d51146300a (diff) |
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 'tools/perf')
-rw-r--r-- | tools/perf/util/sort.c | 5 |
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'); |