Created
September 26, 2011 20:24
-
-
Save seb-m/1243302 to your computer and use it in GitHub Desktop.
XPathQuery leak
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- /Volumes/Sam500/Download/XPathQuery.m 2011-09-26 22:17:18.000000000 +0200 | |
+++ Hpple/XPathQuery.m 2011-09-26 22:14:07.000000000 +0200 | |
@@ -121,6 +121,7 @@ | |
xpathObj = xmlXPathEvalExpression((xmlChar *)[query cStringUsingEncoding:NSUTF8StringEncoding], xpathCtx); | |
if(xpathObj == NULL) { | |
NSLog(@"Unable to evaluate XPath."); | |
+ xmlXPathFreeContext(xpathCtx); | |
return nil; | |
} | |
@@ -128,6 +129,8 @@ | |
if (!nodes) | |
{ | |
NSLog(@"Nodes was nil."); | |
+ xmlXPathFreeObject(xpathObj); | |
+ xmlXPathFreeContext(xpathCtx); | |
return nil; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment