From 1c38b7b48cec5be3c5e0d29714d62fa9b511c064 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 9 Mar 2008 11:03:30 -0400 Subject: [PATCH] Fixing a memory leak * Source/NSXMLElementAdditions.m: ([NSXMLElement(NSXMLElementAdditions) value]): base64_decode_alloc() calls malloc() but not free() so we need to do it ourselves --- Source/NSXMLElementAdditions.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/NSXMLElementAdditions.m b/Source/NSXMLElementAdditions.m index 41cf9b8..1c4d6f9 100644 --- a/Source/NSXMLElementAdditions.m +++ b/Source/NSXMLElementAdditions.m @@ -68,7 +68,10 @@ NSLog(@"error in converting %@ to base64", self); } - return [NSString stringWithCString:data length:datalen]; + NSString *ret = [NSString stringWithCString:data length:datalen]; + free(data); + + return ret; } // just a normal string -- 2.22.5