]> git.hungrycats.org Git - linux/commitdiff
perf sched timehist: Fix missing free of session in perf_sched__timehist()
authorYang Jihong <yangjihong@bytedance.com>
Tue, 6 Aug 2024 02:35:33 +0000 (10:35 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 16 Aug 2024 22:31:15 +0000 (19:31 -0300)
When perf_time__parse_str() fails in perf_sched__timehist(),
need to free session that was previously created, fix it.

Fixes: 853b74071110bed3 ("perf sched timehist: Add option to specify time window of interest")
Signed-off-by: Yang Jihong <yangjihong@bytedance.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: David Ahern <dsa@cumulusnetworks.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240806023533.1316348-1-yangjihong@bytedance.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-sched.c

index 34fe8e540c43da708ca43cddee3a5b3e1fd63dce..9c1276dc8ef6dd7c7a4cf16cf6e9ca529d686082 100644 (file)
@@ -3120,7 +3120,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)