[29416] users/rhwood/MacPorts.Framework/MPInterpreter.m

source_changes at macosforge.org source_changes at macosforge.org
Sun Sep 23 03:41:42 PDT 2007


Revision: 29416
          http://trac.macosforge.org/projects/macports/changeset/29416
Author:   rhwood at macports.org
Date:     2007-09-23 03:41:42 -0700 (Sun, 23 Sep 2007)

Log Message:
-----------
Take steps to avoid a memory leak.

Modified Paths:
--------------
    users/rhwood/MacPorts.Framework/MPInterpreter.m

Modified: users/rhwood/MacPorts.Framework/MPInterpreter.m
===================================================================
--- users/rhwood/MacPorts.Framework/MPInterpreter.m	2007-09-23 10:15:48 UTC (rev 29415)
+++ users/rhwood/MacPorts.Framework/MPInterpreter.m	2007-09-23 10:41:42 UTC (rev 29416)
@@ -97,9 +97,11 @@
 		for (i = 0; i < tclCount; i++) {
 			[array addObject:[NSString stringWithUTF8String:tclElements[i]]];
 		}
-		return [NSArray arrayWithArray:array];
+	} else {
+		array = [[NSMutableArray alloc] init];
 	}
-	return [[NSArray alloc] init];
+	Tcl_Free((char *)tclElements);
+	return [NSArray arrayWithArray:array];
 }
 
 - (NSString *)getVariableAsString:(NSString *)variable {

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070923/f8bfe79b/attachment.html


More information about the macports-changes mailing list