perf inject: Fix missing free in copy_kcore_dir()
authorAdrian Hunter <adrian.hunter@intel.com>
Mon, 20 Jun 2022 10:39:04 +0000 (13:39 +0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Sun, 26 Jun 2022 15:32:15 +0000 (12:32 -0300)
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>
tools/perf/builtin-inject.c

index a75bf11585b5c91915170336e0f2f8fecce9edfe..063f74f5b8db592890b3cb816bc3a199cf240cbf 100644 (file)
@@ -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)