File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -3310,9 +3310,13 @@ static int perf_sched__map(struct perf_sched *sched)
33103310{
33113311 int rc = -1 ;
33123312
3313- if (setup_map_cpus (sched ))
3313+ sched -> curr_thread = calloc (MAX_CPUS , sizeof (* (sched -> curr_thread )));
3314+ if (!sched -> curr_thread )
33143315 return rc ;
33153316
3317+ if (setup_map_cpus (sched ))
3318+ goto out_free_curr_thread ;
3319+
33163320 if (setup_color_pids (sched ))
33173321 goto out_put_map_cpus ;
33183322
@@ -3335,6 +3339,9 @@ static int perf_sched__map(struct perf_sched *sched)
33353339out_put_map_cpus :
33363340 zfree (& sched -> map .comp_cpus );
33373341 perf_cpu_map__put (sched -> map .cpus );
3342+
3343+ out_free_curr_thread :
3344+ zfree (& sched -> curr_thread );
33383345 return rc ;
33393346}
33403347
@@ -3620,11 +3627,6 @@ int cmd_sched(int argc, const char **argv)
36203627 unsigned int i ;
36213628 int ret = 0 ;
36223629
3623- sched .curr_thread = calloc (MAX_CPUS , sizeof (* sched .curr_thread ));
3624- if (!sched .curr_thread ) {
3625- ret = - ENOMEM ;
3626- goto out ;
3627- }
36283630 sched .cpu_last_switched = calloc (MAX_CPUS , sizeof (* sched .cpu_last_switched ));
36293631 if (!sched .cpu_last_switched ) {
36303632 ret = - ENOMEM ;
@@ -3706,7 +3708,6 @@ int cmd_sched(int argc, const char **argv)
37063708out :
37073709 free (sched .curr_pid );
37083710 free (sched .cpu_last_switched );
3709- free (sched .curr_thread );
37103711
37113712 return ret ;
37123713}
You can’t perform that action at this time.
0 commit comments