aboutsummaryrefslogtreecommitdiff
path: root/Foundation
diff options
context:
space:
mode:
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;