summaryrefslogtreecommitdiff
path: root/tools/perf/builtin-inject.c
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2022-06-20 13:39:04 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2022-06-26 18:32:15 +0300
commit342cb0d80613719c5e5ac30619e54b9a3fd83625 (patch)
tree126e4e77ce14b5abfd116ce7af13c25f25e79919 /tools/perf/builtin-inject.c
parent0840a7914caa14315a3191178a9f72c742477860 (diff)
downloadlinux-342cb0d80613719c5e5ac30619e54b9a3fd83625.tar.xz
perf inject: Fix missing free in copy_kcore_dir()
Free string allocated by asprintf(). Fixes: d8fc08550929bb84 ("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>
Diffstat (limited to 'tools/perf/builtin-inject.c')
-rw-r--r--tools/perf/builtin-inject.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index a75bf11585b5..063f74f5b8db 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -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)