From: Kichan Kwon Date: Fri, 25 Mar 2016 02:59:29 +0000 (+0900) Subject: Close file after reading X-Git-Tag: submit/tizen/20160325.030803^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9fc307bb260eadc9b429a0f7d2bdd921d5c7c61c;p=platform%2Fcore%2Fapi%2Fruntime-info.git Close file after reading Change-Id: I23114971925f436109986d163e62d941c57c6470 Signed-off-by: Kichan Kwon --- diff --git a/src/runtime_info_usage.c b/src/runtime_info_usage.c index fec3cc2..441a3b4 100644 --- a/src/runtime_info_usage.c +++ b/src/runtime_info_usage.c @@ -410,11 +410,13 @@ API int runtime_info_get_processor_count(int *num_core) if(!fscanf(cpuinfo_fp, "%d-%d", &buf, &result)) { _E("IO_ERROR(0x%08x) : there is no information in the system file", RUNTIME_INFO_ERROR_IO_ERROR); + fclose(cpuinfo_fp); return RUNTIME_INFO_ERROR_IO_ERROR; } *num_core = result + 1; + fclose(cpuinfo_fp); return RUNTIME_INFO_ERROR_NONE; } @@ -460,11 +462,13 @@ API int runtime_info_get_processor_current_frequency(int core_idx, int *cpu_freq if(!fscanf(cpuinfo_fp, "%d", &result)) { _E("IO_ERROR(0x%08x) : there is no information in the system file", RUNTIME_INFO_ERROR_IO_ERROR); + fclose(cpuinfo_fp); return RUNTIME_INFO_ERROR_IO_ERROR; } *cpu_freq = result / 1000; + fclose(cpuinfo_fp); return RUNTIME_INFO_ERROR_NONE; } @@ -510,10 +514,12 @@ API int runtime_info_get_processor_max_frequency(int core_idx, int *cpu_freq) if(!fscanf(cpuinfo_fp, "%d", &result)) { _E("IO_ERROR(0x%08x) : there is no information in the system file", RUNTIME_INFO_ERROR_IO_ERROR); + fclose(cpuinfo_fp); return RUNTIME_INFO_ERROR_IO_ERROR; } *cpu_freq = result / 1000; + fclose(cpuinfo_fp); return RUNTIME_INFO_ERROR_NONE; }