fix minor leak

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38558 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2015-05-26 13:22:52 +00:00
parent ec040f9650
commit 06ea51b2d8

View file

@ -459,10 +459,8 @@ isEqualTree(xmlNodePtr nodeA, xmlNodePtr nodeB)
- (void) _removeSubNode: (NSXMLNode *)subNode - (void) _removeSubNode: (NSXMLNode *)subNode
{ {
// retain temporarily so we can safely remove from our subNodes list first // retain temporarily so we can safely remove from our subNodes list first
[subNode retain]; AUTORELEASE(RETAIN(subNode));
[internal->subNodes removeObjectIdenticalTo: subNode]; [internal->subNodes removeObjectIdenticalTo: subNode];
// release temporary hold. Apple seems to do an autorelease here.
[subNode autorelease];
} }
- (void) _createInternal - (void) _createInternal
@ -880,11 +878,11 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
{ {
NSXMLNode *n; NSXMLNode *n;
n = [[[self alloc] initWithKind: NSXMLAttributeKind] autorelease]; n = [[self alloc] initWithKind: NSXMLAttributeKind];
[n setStringValue: stringValue]; [n setStringValue: stringValue];
[n setName: name]; [n setName: name];
return n; return AUTORELEASE(n);
} }
+ (id) attributeWithName: (NSString*)name + (id) attributeWithName: (NSString*)name
@ -893,55 +891,55 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
{ {
NSXMLNode *n; NSXMLNode *n;
n = [[[self alloc] initWithKind: NSXMLAttributeKind] autorelease]; n = [[self alloc] initWithKind: NSXMLAttributeKind];
[n setURI: URI]; [n setURI: URI];
[n setStringValue: stringValue]; [n setStringValue: stringValue];
[n setName: name]; [n setName: name];
return n; return AUTORELEASE(n);
} }
+ (id) commentWithStringValue: (NSString*)stringValue + (id) commentWithStringValue: (NSString*)stringValue
{ {
NSXMLNode *n; NSXMLNode *n;
n = [[[self alloc] initWithKind: NSXMLCommentKind] autorelease]; n = [[self alloc] initWithKind: NSXMLCommentKind];
[n setStringValue: stringValue]; [n setStringValue: stringValue];
return n; return AUTORELEASE(n);
} }
+ (id) DTDNodeWithXMLString: (NSString*)string + (id) DTDNodeWithXMLString: (NSString*)string
{ {
NSXMLNode *n; NSXMLNode *n;
n = [[[NSXMLDTDNode alloc] initWithXMLString: string] autorelease]; n = [[NSXMLDTDNode alloc] initWithXMLString: string];
return n; return AUTORELEASE(n);
} }
+ (id) document + (id) document
{ {
NSXMLNode *n; NSXMLNode *n;
n = [[[NSXMLDocument alloc] initWithKind: NSXMLDocumentKind] autorelease]; n = [[NSXMLDocument alloc] initWithKind: NSXMLDocumentKind];
return n; return AUTORELEASE(n);
} }
+ (id) documentWithRootElement: (NSXMLElement*)element + (id) documentWithRootElement: (NSXMLElement*)element
{ {
NSXMLDocument *d; NSXMLDocument *d;
d = [[[NSXMLDocument alloc] initWithRootElement: element] autorelease]; d = [[NSXMLDocument alloc] initWithRootElement: element];
return d; return AUTORELEASE(d);
} }
+ (id) elementWithName: (NSString*)name + (id) elementWithName: (NSString*)name
{ {
NSXMLNode *n; NSXMLNode *n;
n = [[[NSXMLElement alloc] initWithName: name] autorelease]; n = [[NSXMLElement alloc] initWithName: name];
return n; return AUTORELEASE(n);
} }
+ (id) elementWithName: (NSString*)name + (id) elementWithName: (NSString*)name
@ -960,8 +958,8 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
{ {
NSXMLNode *n; NSXMLNode *n;
n = [[[NSXMLElement alloc] initWithName: name URI: URI] autorelease]; n = [[NSXMLElement alloc] initWithName: name URI: URI];
return n; return AUTORELEASE(n);
} }
+ (id) elementWithName: (NSString*)name + (id) elementWithName: (NSString*)name
@ -970,7 +968,7 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
NSXMLElement *e; NSXMLElement *e;
e = [[NSXMLElement alloc] initWithName: name stringValue: string]; e = [[NSXMLElement alloc] initWithName: name stringValue: string];
return e; return AUTORELEASE(e);
} }
+ (NSString*) localNameForName: (NSString*)name + (NSString*) localNameForName: (NSString*)name
@ -999,10 +997,10 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
{ {
NSXMLNode *n; NSXMLNode *n;
n = [[[self alloc] initWithKind: NSXMLNamespaceKind] autorelease]; n = [[self alloc] initWithKind: NSXMLNamespaceKind];
[n setName: name]; [n setName: name];
[n setStringValue: stringValue]; [n setStringValue: stringValue];
return n; return AUTORELEASE(n);
} }
+ (NSXMLNode*) predefinedNamespaceForPrefix: (NSString*)name + (NSXMLNode*) predefinedNamespaceForPrefix: (NSString*)name
@ -1065,19 +1063,19 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
{ {
NSXMLNode *n; NSXMLNode *n;
n = [[[self alloc] initWithKind: NSXMLProcessingInstructionKind] autorelease]; n = [[self alloc] initWithKind: NSXMLProcessingInstructionKind];
[n setStringValue: stringValue]; [n setStringValue: stringValue];
[n setName: name]; [n setName: name];
return n; return AUTORELEASE(n);
} }
+ (id) textWithStringValue: (NSString*)stringValue + (id) textWithStringValue: (NSString*)stringValue
{ {
NSXMLNode *n; NSXMLNode *n;
n = [[[self alloc] initWithKind: NSXMLTextKind] autorelease]; n = [[self alloc] initWithKind: NSXMLTextKind];
[n setStringValue: stringValue]; [n setStringValue: stringValue];
return n; return AUTORELEASE(n);
} }
- (NSString*) canonicalXMLStringPreservingComments: (BOOL)comments - (NSString*) canonicalXMLStringPreservingComments: (BOOL)comments
@ -1198,10 +1196,10 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
{ {
[subNode detach]; [subNode detach];
} }
[theSubNodes release]; RELEASE(theSubNodes);
[internal->objectValue release]; RELEASE(internal->objectValue);
[internal->subNodes release]; RELEASE(internal->subNodes);
if (theNode) if (theNode)
{ {
if (theNode->type == XML_NAMESPACE_DECL) if (theNode->type == XML_NAMESPACE_DECL)
@ -1366,7 +1364,7 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
break; break;
case NSXMLAttributeDeclarationKind: case NSXMLAttributeDeclarationKind:
[self release]; RELEASE(self);
return nil; return nil;
default: default:
@ -1382,7 +1380,7 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
*/ */
if (NO == [self isKindOfClass: theSubclass]) if (NO == [self isKindOfClass: theSubclass])
{ {
[self release]; RELEASE(self);
return [[theSubclass alloc] initWithKind: theKind return [[theSubclass alloc] initWithKind: theKind
options: theOptions]; options: theOptions];
} }
@ -1865,7 +1863,7 @@ execute_xpath(xmlNodePtr node, NSString *xpath_exp, NSDictionary *constants,
[subNode detach]; [subNode detach];
} }
} }
[theSubNodes release]; RELEASE(theSubNodes);
} }
if (resolve == NO) if (resolve == NO)