Permalink
Browse files

Fixing some memory leaks in the unit tests. (Thanks analyzer.)

  • Loading branch information...
1 parent 4608499 commit 55edeb90410cad25cf2072de41b4fa37fea37b5e @robbiehanson committed Apr 14, 2011
Showing with 6 additions and 6 deletions.
  1. +6 −6 DDXMLTesting.m
View
@@ -628,8 +628,8 @@ + (void)testChildren
[xmlStr appendString:@" <!-- budweiser -->"];
[xmlStr appendString:@"</beers> "];
- NSXMLDocument *nsDoc = [[NSXMLDocument alloc] initWithXMLString:xmlStr options:0 error:nil];
- DDXMLDocument *ddDoc = [[DDXMLDocument alloc] initWithXMLString:xmlStr options:0 error:nil];
+ NSXMLDocument *nsDoc = [[[NSXMLDocument alloc] initWithXMLString:xmlStr options:0 error:nil] autorelease];
+ DDXMLDocument *ddDoc = [[[DDXMLDocument alloc] initWithXMLString:xmlStr options:0 error:nil] autorelease];
NSUInteger nsChildCount = [[nsDoc rootElement] childCount];
NSUInteger ddChildCount = [[ddDoc rootElement] childCount];
@@ -765,8 +765,8 @@ + (void)testPreviousNextNode2
[xmlStr appendString:@" </crust> "];
[xmlStr appendString:@"</pizza> "];
- NSXMLDocument *nsDoc = [[NSXMLDocument alloc] initWithXMLString:xmlStr options:0 error:nil];
- DDXMLDocument *ddDoc = [[DDXMLDocument alloc] initWithXMLString:xmlStr options:0 error:nil];
+ NSXMLDocument *nsDoc = [[[NSXMLDocument alloc] initWithXMLString:xmlStr options:0 error:nil] autorelease];
+ DDXMLDocument *ddDoc = [[[DDXMLDocument alloc] initWithXMLString:xmlStr options:0 error:nil] autorelease];
NSXMLNode *nsNode0 = [nsDoc rootElement]; // pizza
DDXMLNode *ddNode0 = [ddDoc rootElement]; // pizza
@@ -1008,10 +1008,10 @@ + (void)testXmlns
NSString *parseMe = @"<query xmlns=\"jabber:iq:roster\"></query>";
NSData *data = [parseMe dataUsingEncoding:NSUTF8StringEncoding];
- NSXMLDocument *nsDoc = [[NSXMLDocument alloc] initWithData:data options:0 error:nil];
+ NSXMLDocument *nsDoc = [[[NSXMLDocument alloc] initWithData:data options:0 error:nil] autorelease];
NSXMLElement *nsRootElement = [nsDoc rootElement];
- DDXMLDocument *ddDoc = [[DDXMLDocument alloc] initWithData:data options:0 error:nil];
+ DDXMLDocument *ddDoc = [[[DDXMLDocument alloc] initWithData:data options:0 error:nil] autorelease];
DDXMLElement *ddRootElement = [ddDoc rootElement];
// Both URI and namespaceForPrefix:@"" should return "jabber:iq:roster"

0 comments on commit 55edeb9

Please sign in to comment.