Currently, we open the system base frequency file, but never close it,
which results in a memory leak.
Coverity issue: 369693
Fixes:
8a5febaac4f7 ("power: fix P-state base frequency handling")
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
FOPEN_OR_ERR_RET(f_base_max, -1);
if (f_base_max != NULL) {
s_base_max = fgets(buf_base, sizeof(buf_base), f_base_max);
+
+ /* close the file unconditionally */
+ fclose(f_base_max);
+ f_base_max = NULL;
+
FOPS_OR_NULL_GOTO(s_base_max, out);
buf_base[BUFSIZ-1] = '\0';