Skip to content

Commit

Permalink
perf inject: Fill in the missing session freeing after an error occurs
Browse files Browse the repository at this point in the history
When an error occur 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: Taeung Song <[email protected]>
Acked-by: Jiri Olsa <[email protected]>
Cc: Namhyung Kim <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
Taeung authored and acmel committed Jul 1, 2015
1 parent ceb9291 commit 9fedfb0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tools/perf/builtin-inject.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,12 +630,13 @@ int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused)
if (inject.session == NULL)
return -1;

if (symbol__init(&inject.session->header.env) < 0)
return -1;
ret = symbol__init(&inject.session->header.env);
if (ret < 0)
goto out_delete;

ret = __cmd_inject(&inject);

out_delete:
perf_session__delete(inject.session);

return ret;
}

0 comments on commit 9fedfb0

Please sign in to comment.