summaryrefslogtreecommitdiffstats
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
parentfc67297b16da335d610af2fac96233d51146300a (diff)
downloadop-kernel-dev-963ba5fd5d04f36d6a5c9a94562484a4f270c1de.zip
op-kernel-dev-963ba5fd5d04f36d6a5c9a94562484a4f270c1de.tar.gz
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>
-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 b4ecc0e..97cf3ef 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');
OpenPOWER on IntegriCloud