Fix leaks

This commit is contained in:
rfm 2024-11-15 13:00:56 +00:00
parent 072c17f315
commit 2f9f0d6761

View file

@ -6,30 +6,30 @@
#import "ObjectTesting.h"
int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSFileManager *mgr;
GSXMLParser *parser;
GSXMLDocument *doc;
GSXMLNamespace *namespace;
NSMutableArray *iparams;
NSMutableArray *oparams;
GSXMLNode *node;
GSXMLRPC *rpc;
NSString *str;
NSString *testPath;
NSString *absolutePath;
NSData *dat;
NSAutoreleasePool *arp = [NSAutoreleasePool new];
NSFileManager *mgr;
GSXMLParser *parser;
GSXMLDocument *doc;
GSXMLNamespace *namespace;
NSMutableArray *iparams;
NSMutableArray *oparams;
GSXMLNode *node;
GSXMLRPC *rpc;
NSString *str;
NSString *testPath;
NSString *absolutePath;
NSData *dat;
TEST_FOR_CLASS(@"GSXMLDocument",[GSXMLDocument alloc],
TEST_FOR_CLASS(@"GSXMLDocument", AUTORELEASE([GSXMLDocument alloc]),
"GSXMLDocument +alloc returns a GSXMLDocument");
TEST_FOR_CLASS(@"GSXMLDocument",[GSXMLDocument documentWithVersion: @"1.0"],
TEST_FOR_CLASS(@"GSXMLDocument", [GSXMLDocument documentWithVersion: @"1.0"],
"GSXMLDocument +documentWithVersion: returns a GSXMLDocument");
TEST_FOR_CLASS(@"GSXMLNode",[GSXMLNode alloc],
TEST_FOR_CLASS(@"GSXMLNode", AUTORELEASE([GSXMLNode alloc]),
"GSXMLNode +alloc returns a GSXMLNode");
TEST_FOR_CLASS(@"GSXMLRPC",[GSXMLRPC alloc],
TEST_FOR_CLASS(@"GSXMLRPC", AUTORELEASE([GSXMLRPC alloc]),
"GSXMLRPC +alloc returns a GSXMLRPC instance");
NS_DURING
@ -39,7 +39,7 @@ int main()
PASS(node == nil, "GSXMLNode +new returns nil");
NS_ENDHANDLER
TEST_FOR_CLASS(@"GSXMLNamespace",[GSXMLNamespace alloc],
TEST_FOR_CLASS(@"GSXMLNamespace", AUTORELEASE([GSXMLNamespace alloc]),
"GSXMLNamespace +alloc returns a GSXMLNamespace");
@ -54,7 +54,6 @@ int main()
node = [doc makeNodeWithNamespace: nil name: @"nicola" content: nil];
PASS (node != nil,"Can create a document node");
[doc setRoot: node];
PASS([[doc root] isEqual: node],"Can set document node as root node");
@ -85,7 +84,8 @@ int main()
"A namespace remembers its prefix");
rpc = [(GSXMLRPC*)[GSXMLRPC alloc] initWithURL: @"http://localhost/"];
rpc = AUTORELEASE([(GSXMLRPC*)[GSXMLRPC alloc]
initWithURL: @"http://localhost/"]);
PASS(rpc != nil, "Can initialise an RPC instance");
iparams = [NSMutableArray array];