pgsql: Fix up memory management problems in contrib/xml2.

Поиск
Список
Период
Сортировка
От tgl@postgresql.org (Tom Lane)
Тема pgsql: Fix up memory management problems in contrib/xml2.
Дата
Msg-id 20100228213157.6F7317541D0@cvs.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Log Message:
-----------
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.

Modified Files:
--------------
    pgsql/contrib/xml2:
        Makefile (r1.12 -> r1.13)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/xml2/Makefile?r1=1.12&r2=1.13)
        xpath.c (r1.26 -> r1.27)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/xml2/xpath.c?r1=1.26&r2=1.27)

Added Files:
-----------
    pgsql/contrib/xml2/expected:
        xml2.out (r1.1)

(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/xml2/expected/xml2.out?rev=1.1&content-type=text/x-cvsweb-markup)
    pgsql/contrib/xml2/sql:
        xml2.sql (r1.1)

(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/contrib/xml2/sql/xml2.sql?rev=1.1&content-type=text/x-cvsweb-markup)

В списке pgsql-committers по дате отправления:

Предыдущее
От: tgl@postgresql.org (Tom Lane)
Дата:
Сообщение: pgsql: New Directory
Следующее
От: stark@postgresql.org (Greg Stark)
Дата:
Сообщение: pgsql: add EPERM to the list of return codes to expect from opening