Skip to content

Commit 724736e

Browse files
author
Marc Nijdam
committed
Fix memory leak
1 parent 9e0c355 commit 724736e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

FastCoder/FastCoder.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -806,9 +806,9 @@ + (NSData *)dataWithRootObject:(id)object
806806
};
807807

808808
//write root object
809-
CFMutableDictionaryRef cache = CFDictionaryCreateMutable(NULL, 0, &keyCallbacks, &valueCallbacks);
810-
uint32_t objectCount = (uint32_t)CFDictionaryGetCount(cache);
811-
FCWriteObject(object, nil, output, (__bridge id)cache);
809+
NSMutableDictionary *cache = CFBridgingRelease(CFDictionaryCreateMutable(NULL, 0, &keyCallbacks, &valueCallbacks));
810+
uint32_t objectCount = (uint32_t)cache.count;
811+
FCWriteObject(object, nil, output, cache);
812812

813813
//set object count and return
814814
[output replaceBytesInRange:NSMakeRange(sizeof(header), sizeof(uint32_t)) withBytes:&objectCount];

0 commit comments

Comments
 (0)