gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Possible memory leaks in NSPropertyList.m ?


From: Philippe Roussel
Subject: Possible memory leaks in NSPropertyList.m ?
Date: Thu, 03 Feb 2011 20:35:48 +0100

Using valgrind I noticed multiple memory leaks (most seem to be false
positives) when running a GNUstep app.

I *think* the following patch fixes two real leaks. Can someone review
this ?

Philippe

Index: Source/NSPropertyList.m
===================================================================
--- Source/NSPropertyList.m     (révision 31995)
+++ Source/NSPropertyList.m     (copie de travail)
@@ -305,11 +305,11 @@
       [self unescape];
       if (opts == NSPropertyListMutableContainersAndLeaves)
         {
-         o = [value mutableCopy];
+         o = AUTORELEASE([value mutableCopy]);
        }
       else
         {
-         o = [value copy];
+         o = AUTORELEASE([value copy]);
        }
       ASSIGN(plist, o);
     }
@@ -1750,6 +1750,7 @@
        }
       NSZoneFree(NSDefaultMallocZone(), base);
       obj = [[NSString alloc] initWithCharacters: map length: len];
+      NSZoneFree(NSDefaultMallocZone(), map);
       [output appendData: [obj dataUsingEncoding: NSUTF8StringEncoding]];
       RELEASE(obj);
     }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]