On Sat, 13 Oct 2007, Jeremy Palmer wrote:
The following bug has been logged online:
Bug reference: 3675
PostgreSQL version: 8.3b1
Operating system: WinXP SP2
Description: Crash on xpath function with 2 parameters
Details:
The following query crashes the backend:
SELECT xpath('/my:a/text()', '<my:a
xmlns:my="http://example.com">test</my:a>');
This patch avoids the double free of xpathcomp and fixes things for me.
Kris Jurka
Index: src/backend/utils/adt/xml.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/xml.c,v
retrieving revision 1.47
diff -c -r1.47 xml.c
*** src/backend/utils/adt/xml.c 23 Sep 2007 21:36:42 -0000 1.47
--- src/backend/utils/adt/xml.c 13 Oct 2007 17:27:17 -0000
***************
*** 3184,3189 ****
--- 3184,3191 ----
xpathobj = xmlXPathCompiledEval(xpathcomp, xpathctx);
xmlXPathFreeCompExpr(xpathcomp);
+ xpathcomp = NULL;
+
if (xpathobj == NULL)
ereport(ERROR, (errmsg("could not create XPath
object"))); /* TODO: reason? */
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings