[PATCH] cpu: cpufreq: fix leak of dir before we return

Colin King colin.king at canonical.com
Mon May 6 21:33:45 UTC 2013


From: Colin Ian King <colin.king at canonical.com>

Coverity CID #997352, Resource leak.

Need to closedir before we return.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/cpu/cpufreq/cpufreq.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c
index 5133f51..df52100 100644
--- a/src/cpu/cpufreq/cpufreq.c
+++ b/src/cpu/cpufreq/cpufreq.c
@@ -495,6 +495,7 @@ static void do_sw_any_test(fwts_framework *fw)
 	if (get_performance_repeat(fw, first_cpu_index, 5, GET_PERFORMANCE_MIN, &lowperf) != FWTS_OK) {
 		fwts_failed(fw, LOG_LEVEL_MEDIUM, "CPUFreqSW_ANYGetPerf",
 			"Failed to get CPU performance.");
+		closedir(dir);
 		return;
 	}
 	lowperf = (100 * lowperf) / top_speed;
-- 
1.8.1.2




More information about the fwts-devel mailing list