From 936c4af1c6876e09e914eca91c37949e6885b02e Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 28 Feb 2010 21:31:57 +0000 Subject: Fix up memory management problems in contrib/xml2. Get rid of the code that attempted to funnel libxml2's memory allocations into palloc. We already knew from experience with the core xml datatype that trying to do this is simply not reliable. Unlike the core code, I did not bother adding a lot of PG_TRY/PG_CATCH logic to try to ensure that everything is cleaned up on error exit. Hence, we might leak some memory if one of these functions fails partway through. Given the deprecated status of this contrib module and the fact that errors partway through the functions shouldn't be too common, it doesn't seem worth worrying about. Also fix a separate bug in xpath_table, that it did the wrong things if given a result tuple descriptor with less than 2 columns. While such a case isn't very useful in practice, we shouldn't fail or stomp memory when it occurs. Add some simple regression tests based on all the reported crash cases that I have on hand. This should be back-patched, but let's see if the buildfarm likes it first. --- contrib/xml2/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'contrib/xml2/Makefile') diff --git a/contrib/xml2/Makefile b/contrib/xml2/Makefile index b96defa5d6..3426deaa25 100644 --- a/contrib/xml2/Makefile +++ b/contrib/xml2/Makefile @@ -1,4 +1,4 @@ -# $PostgreSQL: pgsql/contrib/xml2/Makefile,v 1.12 2008/05/08 16:49:37 tgl Exp $ +# $PostgreSQL: pgsql/contrib/xml2/Makefile,v 1.13 2010/02/28 21:31:57 tgl Exp $ MODULE_big = pgxml @@ -8,6 +8,7 @@ SHLIB_LINK += $(filter -lxslt, $(LIBS)) $(filter -lxml2, $(LIBS)) DATA_built = pgxml.sql DATA = uninstall_pgxml.sql +REGRESS = xml2 ifdef USE_PGXS PG_CONFIG = pg_config -- cgit v1.2.3