summaryrefslogtreecommitdiff
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 12:32:15 -0300
commit342cb0d80613719c5e5ac30619e54b9a3fd83625 (patch)
tree126e4e77ce14b5abfd116ce7af13c25f25e79919
parent0840a7914caa14315a3191178a9f72c742477860 (diff)
downloadlwn-342cb0d80613719c5e5ac30619e54b9a3fd83625.tar.gz
lwn-342cb0d80613719c5e5ac30619e54b9a3fd83625.zip
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>
-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)