File tree 1 file changed +8
-7
lines changed
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)
3310
3310
{
3311
3311
int rc = -1 ;
3312
3312
3313
- if (setup_map_cpus (sched ))
3313
+ sched -> curr_thread = calloc (MAX_CPUS , sizeof (* (sched -> curr_thread )));
3314
+ if (!sched -> curr_thread )
3314
3315
return rc ;
3315
3316
3317
+ if (setup_map_cpus (sched ))
3318
+ goto out_free_curr_thread ;
3319
+
3316
3320
if (setup_color_pids (sched ))
3317
3321
goto out_put_map_cpus ;
3318
3322
@@ -3335,6 +3339,9 @@ static int perf_sched__map(struct perf_sched *sched)
3335
3339
out_put_map_cpus :
3336
3340
zfree (& sched -> map .comp_cpus );
3337
3341
perf_cpu_map__put (sched -> map .cpus );
3342
+
3343
+ out_free_curr_thread :
3344
+ zfree (& sched -> curr_thread );
3338
3345
return rc ;
3339
3346
}
3340
3347
@@ -3620,11 +3627,6 @@ int cmd_sched(int argc, const char **argv)
3620
3627
unsigned int i ;
3621
3628
int ret = 0 ;
3622
3629
3623
- sched .curr_thread = calloc (MAX_CPUS , sizeof (* sched .curr_thread ));
3624
- if (!sched .curr_thread ) {
3625
- ret = - ENOMEM ;
3626
- goto out ;
3627
- }
3628
3630
sched .cpu_last_switched = calloc (MAX_CPUS , sizeof (* sched .cpu_last_switched ));
3629
3631
if (!sched .cpu_last_switched ) {
3630
3632
ret = - ENOMEM ;
@@ -3706,7 +3708,6 @@ int cmd_sched(int argc, const char **argv)
3706
3708
out :
3707
3709
free (sched .curr_pid );
3708
3710
free (sched .cpu_last_switched );
3709
- free (sched .curr_thread );
3710
3711
3711
3712
return ret ;
3712
3713
}
You can’t perform that action at this time.
0 commit comments