pgsql: Fix low-probability memory leak in XMLSERIALIZE(... INDENT).

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix low-probability memory leak in XMLSERIALIZE(... INDENT).
Date: 2025-07-08 16:50:47
Message-ID: E1uZBWp-005Hyl-0c@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix low-probability memory leak in XMLSERIALIZE(... INDENT).

xmltotext_with_options() did not consider the possibility that
pg_xml_init() could fail --- most likely due to OOM. If that
happened, the already-parsed xmlDoc structure would be leaked.
Oversight in commit 483bdb2af.

Bug: #18981
Author: Dmitry Kovalenko <d(dot)kovalenko(at)postgrespro(dot)ru>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/18981-9bc3c80f107ae925@postgresql.org
Backpatch-through: 16

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/075554ec6c0c8ef9fca38086624d27d8df2a27d7

Modified Files
--------------
src/backend/utils/adt/xml.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2025-07-08 21:00:39 pgsql: Fix up misuse of "volatile" in contrib/xml2.
Previous Message Álvaro Herrera 2025-07-08 16:39:47 pgsql: Fix a couple more places in docs for pg_lsn change