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 @@ -3266,9 +3266,13 @@ static int perf_sched__map(struct perf_sched *sched)
3266
3266
{
3267
3267
int rc = -1 ;
3268
3268
3269
- if (setup_map_cpus (sched ))
3269
+ sched -> curr_thread = calloc (MAX_CPUS , sizeof (* (sched -> curr_thread )));
3270
+ if (!sched -> curr_thread )
3270
3271
return rc ;
3271
3272
3273
+ if (setup_map_cpus (sched ))
3274
+ goto out_free_curr_thread ;
3275
+
3272
3276
if (setup_color_pids (sched ))
3273
3277
goto out_put_map_cpus ;
3274
3278
@@ -3291,6 +3295,9 @@ static int perf_sched__map(struct perf_sched *sched)
3291
3295
out_put_map_cpus :
3292
3296
zfree (& sched -> map .comp_cpus );
3293
3297
perf_cpu_map__put (sched -> map .cpus );
3298
+
3299
+ out_free_curr_thread :
3300
+ zfree (& sched -> curr_thread );
3294
3301
return rc ;
3295
3302
}
3296
3303
@@ -3576,11 +3583,6 @@ int cmd_sched(int argc, const char **argv)
3576
3583
unsigned int i ;
3577
3584
int ret = 0 ;
3578
3585
3579
- sched .curr_thread = calloc (MAX_CPUS , sizeof (* sched .curr_thread ));
3580
- if (!sched .curr_thread ) {
3581
- ret = - ENOMEM ;
3582
- goto out ;
3583
- }
3584
3586
sched .cpu_last_switched = calloc (MAX_CPUS , sizeof (* sched .cpu_last_switched ));
3585
3587
if (!sched .cpu_last_switched ) {
3586
3588
ret = - ENOMEM ;
@@ -3662,7 +3664,6 @@ int cmd_sched(int argc, const char **argv)
3662
3664
out :
3663
3665
free (sched .curr_pid );
3664
3666
free (sched .cpu_last_switched );
3665
- free (sched .curr_thread );
3666
3667
3667
3668
return ret ;
3668
3669
}
You can’t perform that action at this time.
0 commit comments