#if 0
if (uri)
xmlFreeURI(uri);
+ uri = NULL;
#endif
if (dtd)
xmlFreeDtd(dtd);
+ dtd = NULL;
if (doc)
xmlFreeDoc(doc);
+ doc = NULL;
if (ctxt)
xmlFreeParserCtxt(ctxt);
+ ctxt = NULL;
xmlCleanupParser();
}
PG_CATCH();
if (ctxt)
xmlFreeParserCtxt(ctxt);
+ ctxt = NULL;
xmlCleanupParser();
}
PG_CATCH();
{
if (doc)
xmlFreeDoc(doc);
- doc = NULL;
if (ctxt)
xmlFreeParserCtxt(ctxt);
xmlCleanupParser();
"invalid XPath expression"); /* TODO: show proper XPath error details */
xpathobj = xmlXPathCompiledEval(xpathcomp, xpathctx);
- xmlXPathFreeCompExpr(xpathcomp);
if (xpathobj == NULL)
ereport(ERROR, (errmsg("could not create XPath object"))); /* TODO: reason? */
+ xmlXPathFreeCompExpr(xpathcomp);
+ xpathcomp = NULL;
+
/* return empty array in cases when nothing is found */
if (xpathobj->nodesetval == NULL)
res_nitems = 0;
}
xmlXPathFreeObject(xpathobj);
+ xpathobj = NULL;
xmlXPathFreeContext(xpathctx);
- xmlFreeParserCtxt(ctxt);
+ xpathctx = NULL;
xmlFreeDoc(doc);
+ doc = NULL;
+ xmlFreeParserCtxt(ctxt);
+ ctxt = NULL;
xmlCleanupParser();
}
PG_CATCH();