xml2memleakfix.diff
text/x-patch
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: context
| File | + | − |
|---|---|---|
| ./xpath.c | 22 | 2 |
*** ./xpath.c.orig 2010-03-03 20:10:29.000000000 +0100
--- ./xpath.c 2010-11-26 09:50:42.492451256 +0100
***************
*** 53,58 ****
--- 53,61 ----
static xmlXPathObjectPtr pgxml_xpath(text *document, xmlChar *xpath);
+ /* should be global, to be realeased */
+ static xmlDocPtr doctree;
+ static xmlXPathContextPtr ctxt;
/*
* Initialize for xml parsing.
***************
*** 238,243 ****
--- 241,250 ----
if (xpres == NULL)
PG_RETURN_NULL();
+
+ xmlXPathFreeContext(ctxt);
+ xmlFreeDoc(doctree);
+
PG_RETURN_TEXT_P(xpres);
}
***************
*** 272,277 ****
--- 279,288 ----
if (xpres == NULL)
PG_RETURN_NULL();
+
+ xmlXPathFreeContext(ctxt);
+ xmlFreeDoc(doctree);
+
PG_RETURN_TEXT_P(xpres);
}
***************
*** 310,315 ****
--- 321,330 ----
if (xpres == NULL)
PG_RETURN_NULL();
+
+ xmlXPathFreeContext(ctxt);
+ xmlFreeDoc(doctree);
+
PG_RETURN_TEXT_P(xpres);
}
***************
*** 341,346 ****
--- 356,365 ----
fRes = xmlXPathCastToNumber(res);
+ /* release a used context and document */
+ xmlXPathFreeContext(ctxt);
+ xmlFreeDoc(doctree);
+
if (xmlXPathIsNaN(fRes))
PG_RETURN_NULL();
***************
*** 375,380 ****
--- 394,402 ----
bRes = xmlXPathCastToBoolean(res);
+ xmlXPathFreeContext(ctxt);
+ xmlFreeDoc(doctree);
+
PG_RETURN_BOOL(bRes);
}
***************
*** 385,392 ****
static xmlXPathObjectPtr
pgxml_xpath(text *document, xmlChar *xpath)
{
- xmlDocPtr doctree;
- xmlXPathContextPtr ctxt;
xmlXPathObjectPtr res;
xmlXPathCompExprPtr comppath;
int32 docsize;
--- 407,412 ----