aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPEncodingPopupAccessory.m
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2015-06-30 23:10:40 +0200
committerMax <post@wickenrode.com>2015-06-30 23:10:40 +0200
commit3c49b0f2bc16777f83cf57825448b6689ed344e1 (patch)
tree3abbf089b7794a1c81a4d9e483d94957ffbb16bd /Source/SPEncodingPopupAccessory.m
parent6d372fabdf53b8d511da42fca1a7a00fb4950539 (diff)
downloadsequelpro-3c49b0f2bc16777f83cf57825448b6689ed344e1.tar.gz
sequelpro-3c49b0f2bc16777f83cf57825448b6689ed344e1.tar.bz2
sequelpro-3c49b0f2bc16777f83cf57825448b6689ed344e1.zip
Replace some malloc(a*b) with the safer calloc(a,b) variant
Diffstat (limited to 'Source/SPEncodingPopupAccessory.m')
-rw-r--r--Source/SPEncodingPopupAccessory.m3
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/SPEncodingPopupAccessory.m b/Source/SPEncodingPopupAccessory.m
index 6c0df107..6c6be255 100644
--- a/Source/SPEncodingPopupAccessory.m
+++ b/Source/SPEncodingPopupAccessory.m
@@ -29,6 +29,7 @@
// More info at <https://github.com/sequelpro/sequelpro>
#import "SPEncodingPopupAccessory.h"
+#include <stdlib.h>
@implementation SPEncodingPopupAccessory
@@ -92,7 +93,7 @@ static int encodingCompare(const void *firstPtr, const void *secondPtr)
while (cfEncodings[num] != kCFStringEncodingInvalidId) num++;
- tmp = malloc(sizeof(CFStringEncoding) * num);
+ tmp = calloc(num, sizeof(CFStringEncoding));
memcpy(tmp, cfEncodings, sizeof(CFStringEncoding) * num);