Commit 1df9fade authored by Taeung Song's avatar Taeung Song Committed by Arnaldo Carvalho de Melo

perf mem: Fill in the missing session freeing after an error occurs

When an error occurs an error value is just returned without freeing the
session. So allocating and freeing session have to be matched as a pair
even if an error occurs.
Signed-off-by: default avatarTaeung Song <treeze.taeung@gmail.com>
Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1435752499-11752-1-git-send-email-treeze.taeung@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 41b98360
...@@ -124,7 +124,6 @@ static int report_raw_events(struct perf_mem *mem) ...@@ -124,7 +124,6 @@ static int report_raw_events(struct perf_mem *mem)
.mode = PERF_DATA_MODE_READ, .mode = PERF_DATA_MODE_READ,
.force = mem->force, .force = mem->force,
}; };
int err = -EINVAL;
int ret; int ret;
struct perf_session *session = perf_session__new(&file, false, struct perf_session *session = perf_session__new(&file, false,
&mem->tool); &mem->tool);
...@@ -135,24 +134,21 @@ static int report_raw_events(struct perf_mem *mem) ...@@ -135,24 +134,21 @@ static int report_raw_events(struct perf_mem *mem)
if (mem->cpu_list) { if (mem->cpu_list) {
ret = perf_session__cpu_bitmap(session, mem->cpu_list, ret = perf_session__cpu_bitmap(session, mem->cpu_list,
mem->cpu_bitmap); mem->cpu_bitmap);
if (ret) if (ret < 0)
goto out_delete; goto out_delete;
} }
if (symbol__init(&session->header.env) < 0) ret = symbol__init(&session->header.env);
return -1; if (ret < 0)
goto out_delete;
printf("# PID, TID, IP, ADDR, LOCAL WEIGHT, DSRC, SYMBOL\n"); printf("# PID, TID, IP, ADDR, LOCAL WEIGHT, DSRC, SYMBOL\n");
err = perf_session__process_events(session); ret = perf_session__process_events(session);
if (err)
return err;
return 0;
out_delete: out_delete:
perf_session__delete(session); perf_session__delete(session);
return err; return ret;
} }
static int report_events(int argc, const char **argv, struct perf_mem *mem) static int report_events(int argc, const char **argv, struct perf_mem *mem)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment