* [PATCH] perf inject: Fix missing free in copy_kcore_dir()
@ 2022-06-20 10:39 Adrian Hunter
2022-06-20 20:57 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 2+ messages in thread
From: Adrian Hunter @ 2022-06-20 10:39 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo; +Cc: Jiri Olsa, linux-kernel
Free string allocated by asprintf().
Fixes: d8fc08550929bb ("perf inject: Keep a copy of kcore_dir")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
tools/perf/builtin-inject.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index 42e2918fd1cc..fee9da14afc6 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)
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] perf inject: Fix missing free in copy_kcore_dir()
2022-06-20 10:39 [PATCH] perf inject: Fix missing free in copy_kcore_dir() Adrian Hunter
@ 2022-06-20 20:57 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2022-06-20 20:57 UTC (permalink / raw)
To: Adrian Hunter; +Cc: Jiri Olsa, linux-kernel
Em Mon, Jun 20, 2022 at 01:39:04PM +0300, Adrian Hunter escreveu:
> Free string allocated by asprintf().
>
> Fixes: d8fc08550929bb ("perf inject: Keep a copy of kcore_dir")
> Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Thanks, applied.
- Arnaldo
> ---
> tools/perf/builtin-inject.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
> index 42e2918fd1cc..fee9da14afc6 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)
> --
> 2.25.1
--
- Arnaldo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-20 20:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-20 10:39 [PATCH] perf inject: Fix missing free in copy_kcore_dir() Adrian Hunter
2022-06-20 20:57 ` Arnaldo Carvalho de Melo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.