Skip to content

Commit

Permalink
perf inject: Fix missing free in copy_kcore_dir()
Browse files Browse the repository at this point in the history
Free string allocated by asprintf().

Fixes: d8fc085 ("perf inject: Keep a copy of kcore_dir")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20220620103904.7960-1-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
ahunter6 authored and acmel committed Jun 26, 2022
1 parent 0840a79 commit 342cb0d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/perf/builtin-inject.c
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,9 @@ static int copy_kcore_dir(struct perf_inject *inject)
if (ret < 0)
return ret;
pr_debug("%s\n", cmd);
return system(cmd);
ret = system(cmd);
free(cmd);
return ret;
}

static int output_fd(struct perf_inject *inject)
Expand Down

0 comments on commit 342cb0d

Please sign in to comment.