Messages in this thread Patch in this message | | | From | Namhyung Kim <> | Subject | [PATCH 1/9] perf sort: Fix a memory leak on srcline | Date | Wed, 11 Sep 2013 14:09:25 +0900 |
| |
From: Namhyung Kim <namhyung.kim@lge.com>
In the hist_entry__srcline_snprintf(), path and self->srcline are pointing the same memory region, but they are doubly allocated.
Reviewed-by: Jiri Olsa <jolsa@redhat.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org> --- tools/perf/util/sort.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index 5f118a089519..5ba29fc679c5 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'); -- 1.7.11.7
| |