[PATCH 2/3] cpu: maxfreq: use number of cpus as number of items in calloc()

Colin King colin.king at canonical.com
Wed Apr 24 09:25:22 UTC 2013


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

Use number of cpus as number if items in calloc().

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

diff --git a/src/cpu/maxfreq/maxfreq.c b/src/cpu/maxfreq/maxfreq.c
index a91ec30..7678333 100644
--- a/src/cpu/maxfreq/maxfreq.c
+++ b/src/cpu/maxfreq/maxfreq.c
@@ -79,7 +79,7 @@ static int maxfreq_test1(fwts_framework *fw)
 			cpus++;
 	}
 
-	if ((cpufreq = calloc(1, sizeof(int)*cpus)) == NULL) {
+	if ((cpufreq = calloc(cpus, sizeof(int))) == NULL) {
 		fwts_log_error(fw, "Cannot create cpu frequency array.");
 		return FWTS_ERROR;
 	}
-- 
1.8.1.2




More information about the fwts-devel mailing list