Re: [PATCH] perf sched timehist: Fix missing free of session in perf_sched__timehist()

From: Namhyung Kim
Date: Fri Aug 16 2024 - 13:01:35 EST


On Tue, Aug 06, 2024 at 10:35:33AM +0800, Yang Jihong wrote:
> When perf_time__parse_str() fails in perf_sched__timehist(),
> need to free session that was previously created, fix it.
>
> Fixes: 853b74071110 ("perf sched timehist: Add option to specify time window of interest")
> Signed-off-by: Yang Jihong <yangjihong@xxxxxxxxxxxxx>

Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx>

Thanks,
Namhyung

> ---
> tools/perf/builtin-sched.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
> index 8750b5f2d49b..928b9041535d 100644
> --- a/tools/perf/builtin-sched.c
> +++ b/tools/perf/builtin-sched.c
> @@ -3121,7 +3121,8 @@ static int perf_sched__timehist(struct perf_sched *sched)
>
> if (perf_time__parse_str(&sched->ptime, sched->time_str) != 0) {
> pr_err("Invalid time string\n");
> - return -EINVAL;
> + err = -EINVAL;
> + goto out;
> }
>
> if (timehist_check_attr(sched, evlist) != 0)
> --
> 2.25.1
>