From 3c49b0f2bc16777f83cf57825448b6689ed344e1 Mon Sep 17 00:00:00 2001 From: Max Date: Tue, 30 Jun 2015 23:10:40 +0200 Subject: Replace some malloc(a*b) with the safer calloc(a,b) variant --- Frameworks/SPMySQLFramework/Source/SPMySQLFastStreamingResult.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Frameworks/SPMySQLFramework/Source') diff --git a/Frameworks/SPMySQLFramework/Source/SPMySQLFastStreamingResult.m b/Frameworks/SPMySQLFramework/Source/SPMySQLFastStreamingResult.m index 705b3daf..930180da 100644 --- a/Frameworks/SPMySQLFramework/Source/SPMySQLFastStreamingResult.m +++ b/Frameworks/SPMySQLFramework/Source/SPMySQLFastStreamingResult.m @@ -32,6 +32,7 @@ #import "SPMySQL Private APIs.h" #import "SPMySQLArrayAdditions.h" #include +#include static id NSNullPointer; @@ -360,7 +361,7 @@ typedef struct st_spmysqlstreamingrowdata { newRowStore->nextRow = NULL; // Set up the row data store - a char* - and copy in the data if there is any. - newRowStore->data = malloc(sizeOfChar * rowDataLength); + newRowStore->data = calloc(rowDataLength, sizeOfChar); for (i = 0; i < numberOfFields; i++) { if (theRow[i] != NULL) { memcpy(newRowStore->data+dataCopiedLength, theRow[i], fieldLengths[i]); -- cgit v1.2.3