power: fix file descriptor leak
Coverity issue: 328528
Fixes: e6c6dc0f96
("power: add p-state driver compatibility")
Signed-off-by: Liang Ma <liang.j.ma@intel.com>
Reviewed-by: Lei Yao <lei.a.yao@intel.com>
Tested-by: Lei Yao <lei.a.yao@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
This commit is contained in:
parent
566b4d7a96
commit
7c06d9258a
@ -160,6 +160,9 @@ power_init_for_setting_freq(struct pstate_power_info *pi)
|
||||
pi->lcore_id);
|
||||
|
||||
f_max = fopen(fullpath_max, "rw+");
|
||||
if (f_max == NULL)
|
||||
fclose(f_min);
|
||||
|
||||
FOPEN_OR_ERR_RET(f_max, -1);
|
||||
|
||||
pi->f_cur_min = f_min;
|
||||
@ -398,6 +401,9 @@ power_get_available_freqs(struct pstate_power_info *pi)
|
||||
FOPEN_OR_ERR_RET(f_min, ret);
|
||||
|
||||
f_max = fopen(fullpath_max, "r");
|
||||
if (f_max == NULL)
|
||||
fclose(f_min);
|
||||
|
||||
FOPEN_OR_ERR_RET(f_max, ret);
|
||||
|
||||
s_min = fgets(buf_min, sizeof(buf_min), f_min);
|
||||
|
Loading…
Reference in New Issue
Block a user