tools/power/x86/intel-speed-select: Add missing free cpuset
authorSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Wed, 22 Feb 2023 11:26:29 +0000 (03:26 -0800)
committerSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Wed, 22 Mar 2023 20:36:55 +0000 (13:36 -0700)
During perf level change cpuset is allocated but not freed.
Add free_cpu_set() in success and failure path.

Although this is not an issue, as the program will exit after
processing of online/offline, but for completeness add the
free_cpu_set().

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
tools/power/x86/intel-speed-select/isst-config.c

index a040056..a9bd87b 100644 (file)
@@ -1271,7 +1271,7 @@ display_result:
                ret = isst_get_coremask_info(id, tdp_level, &ctdp_level);
                if (ret) {
                        isst_display_error_info_message(1, "Can't get coremask, online/offline option is ignored", 0, 0);
-                       return;
+                       goto free_mask;
                }
                if (ctdp_level.cpu_count) {
                        int i, max_cpus = get_topo_max_cpus();
@@ -1288,6 +1288,8 @@ display_result:
                                }
                        }
                }
+free_mask:
+               free_cpu_set(ctdp_level.core_cpumask);
        }
 }