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 @@ -3298,9 +3298,13 @@ static int perf_sched__map(struct perf_sched *sched)
3298
3298
{
3299
3299
int rc = -1 ;
3300
3300
3301
- if (setup_map_cpus (sched ))
3301
+ sched -> curr_thread = calloc (MAX_CPUS , sizeof (* (sched -> curr_thread )));
3302
+ if (!sched -> curr_thread )
3302
3303
return rc ;
3303
3304
3305
+ if (setup_map_cpus (sched ))
3306
+ goto out_free_curr_thread ;
3307
+
3304
3308
if (setup_color_pids (sched ))
3305
3309
goto out_put_map_cpus ;
3306
3310
@@ -3323,6 +3327,9 @@ static int perf_sched__map(struct perf_sched *sched)
3323
3327
out_put_map_cpus :
3324
3328
zfree (& sched -> map .comp_cpus );
3325
3329
perf_cpu_map__put (sched -> map .cpus );
3330
+
3331
+ out_free_curr_thread :
3332
+ zfree (& sched -> curr_thread );
3326
3333
return rc ;
3327
3334
}
3328
3335
@@ -3608,11 +3615,6 @@ int cmd_sched(int argc, const char **argv)
3608
3615
unsigned int i ;
3609
3616
int ret = 0 ;
3610
3617
3611
- sched .curr_thread = calloc (MAX_CPUS , sizeof (* sched .curr_thread ));
3612
- if (!sched .curr_thread ) {
3613
- ret = - ENOMEM ;
3614
- goto out ;
3615
- }
3616
3618
sched .cpu_last_switched = calloc (MAX_CPUS , sizeof (* sched .cpu_last_switched ));
3617
3619
if (!sched .cpu_last_switched ) {
3618
3620
ret = - ENOMEM ;
@@ -3694,7 +3696,6 @@ int cmd_sched(int argc, const char **argv)
3694
3696
out :
3695
3697
free (sched .curr_pid );
3696
3698
free (sched .cpu_last_switched );
3697
- free (sched .curr_thread );
3698
3699
3699
3700
return ret ;
3700
3701
}
You can’t perform that action at this time.
0 commit comments