@@ -3208,8 +3208,6 @@ static int perf_sched__lat(struct perf_sched *sched)
3208
3208
3209
3209
static int setup_map_cpus (struct perf_sched * sched )
3210
3210
{
3211
- struct perf_cpu_map * map ;
3212
-
3213
3211
sched -> max_cpu .cpu = sysconf (_SC_NPROCESSORS_CONF );
3214
3212
3215
3213
if (sched -> map .comp ) {
@@ -3218,16 +3216,15 @@ static int setup_map_cpus(struct perf_sched *sched)
3218
3216
return -1 ;
3219
3217
}
3220
3218
3221
- if (! sched -> map .cpus_str )
3222
- return 0 ;
3223
-
3224
- map = perf_cpu_map__new ( sched -> map .cpus_str );
3225
- if (! map ) {
3226
- pr_err ( "failed to get cpus map from %s\n" , sched -> map . cpus_str ) ;
3227
- return -1 ;
3219
+ if (sched -> map .cpus_str ) {
3220
+ sched -> map . cpus = perf_cpu_map__new ( sched -> map . cpus_str ) ;
3221
+ if (! sched -> map . cpus ) {
3222
+ pr_err ( "failed to get cpus map from %s\n" , sched -> map .cpus_str );
3223
+ zfree ( & sched -> map . comp_cpus );
3224
+ return -1 ;
3225
+ }
3228
3226
}
3229
3227
3230
- sched -> map .cpus = map ;
3231
3228
return 0 ;
3232
3229
}
3233
3230
@@ -3267,20 +3264,34 @@ static int setup_color_cpus(struct perf_sched *sched)
3267
3264
3268
3265
static int perf_sched__map (struct perf_sched * sched )
3269
3266
{
3267
+ int rc = -1 ;
3268
+
3270
3269
if (setup_map_cpus (sched ))
3271
- return -1 ;
3270
+ return rc ;
3272
3271
3273
3272
if (setup_color_pids (sched ))
3274
- return -1 ;
3273
+ goto out_put_map_cpus ;
3275
3274
3276
3275
if (setup_color_cpus (sched ))
3277
- return -1 ;
3276
+ goto out_put_color_pids ;
3278
3277
3279
3278
setup_pager ();
3280
3279
if (perf_sched__read_events (sched ))
3281
- return -1 ;
3280
+ goto out_put_color_cpus ;
3281
+
3282
+ rc = 0 ;
3282
3283
print_bad_events (sched );
3283
- return 0 ;
3284
+
3285
+ out_put_color_cpus :
3286
+ perf_cpu_map__put (sched -> map .color_cpus );
3287
+
3288
+ out_put_color_pids :
3289
+ perf_thread_map__put (sched -> map .color_pids );
3290
+
3291
+ out_put_map_cpus :
3292
+ zfree (& sched -> map .comp_cpus );
3293
+ perf_cpu_map__put (sched -> map .cpus );
3294
+ return rc ;
3284
3295
}
3285
3296
3286
3297
static int perf_sched__replay (struct perf_sched * sched )
0 commit comments