aboutsummaryrefslogtreecommitdiff
path: root/Foundation
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2013-05-03 21:00:17 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2013-05-03 21:00:17 +0000
commita5d6ae8f62622465a2f5f26b8880029793b2c35d (patch)
tree8dadbddf31c94f6762b77e2455c5fc77ca3142f4 /Foundation
parent1690d12f0e571c5a9a220503a78889795a1c12a9 (diff)
Fix:Analyzer complains that -[init] causes a call to calloc() with 0 as the number of bytes, and calloc isn't defined for 0.
DELTA=6 (5 added, 0 deleted, 1 changed)
Diffstat (limited to 'Foundation')
-rw-r--r--Foundation/GTMLoggerRingBufferWriter.m7
1 files changed, 6 insertions, 1 deletions
diff --git a/Foundation/GTMLoggerRingBufferWriter.m b/Foundation/GTMLoggerRingBufferWriter.m
index 30bd6b6..20f2795 100644
--- a/Foundation/GTMLoggerRingBufferWriter.m
+++ b/Foundation/GTMLoggerRingBufferWriter.m
@@ -65,7 +65,12 @@ typedef void (GTMRingBufferPairCallback)(GTMLoggerRingBufferWriter *rbw,
writer_ = [writer retain];
capacity_ = capacity;
- buffer_ = (GTMRingBufferPair *)calloc(capacity_, sizeof(GTMRingBufferPair));
+ // iVars are initialized to NULL.
+ // Calling calloc with 0 is outside the standard.
+ if (capacity_) {
+ buffer_ = (GTMRingBufferPair *)calloc(capacity_,
+ sizeof(GTMRingBufferPair));
+ }
nextIndex_ = 0;