* Source/NSXMLNode.m: Fix a crashing bug after an invalid xpath

expression is used.



git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34848 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2012-02-29 21:13:13 +00:00
parent 3951bd7a66
commit c6c26748a3
2 changed files with 11 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2012-02-27 Doug Simons <doug.simons@testplant.com>
* Source/NSXMLNode.m: Fix a crashing bug after an invalid xpath
expression is used.
2012-02-29 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Additions/NSError+GNUstepBase.m: try to ensure we always get

View file

@ -647,8 +647,7 @@ NSArray *execute_xpath(NSXMLNode *xmlNode,
if (xpathObj == NULL)
{
NSLog(@"Error: unable to evaluate xpath expression \"%s\"", xpathExpr);
xmlXPathFreeContext(xpathCtx);
xmlFreeDoc(doc);
xmlXPathFreeContext(xpathCtx);
return nil;
}
@ -937,12 +936,15 @@ NSArray *execute_xpath(NSXMLNode *xmlNode,
- (id) copyWithZone: (NSZone*)zone
{
id c = [[self class] allocWithZone: zone];
// make a deep copy
xmlNodePtr newNode = xmlCopyNode([self _node], 2);
xmlNodePtr newNode = xmlCopyNode([self _node], 1); // make a deep copy
clearPrivatePointers(newNode);
//c = [c initWithKind: internal->kind options: internal->options];
//[c _setNode: newNode];
c = [c _initWithNode: newNode kind: internal->kind];
// [c setName: [self name]];
// [c setURI: [self URI]];
// [c setObjectValue: [self objectValue]];