postgresql/contrib/xml2
Michael Paquier 9ec568b3eb xml2: Fix stylesheet document leak in xslt_process()
xslt_process() parses the stylesheet text into an xmlDoc before passing it
to xsltParseStylesheetDoc().  On success, the returned stylesheet owns
that document and frees it through xsltFreeStylesheet(), calling
xmlFreeDoc() at its end.  On failure, libxslt leaves the caller
responsible for the xmlDoc.  In xml2, this would cause the memory
allocated for the xmlDoc to pile up across calls of xslt_process() when
failing to create a sheet.

While on it, I have double-checked the code of xml2 with libxslt, and it
seems that we are in the clear now, hopefully..  This leak exists for a
long time.  732061150b has made the fix introduced in this commit
easier to implement.

Author: Andrey Chernyy <andrey.cherny@tantorlabs.com>
Discussion: https://postgr.es/m/20260605024642.5a1b6518@andrnote
2026-06-05 14:29:27 +09:00
..
expected xml2: Fix failure with xslt_process() under -fsanitize=undefined 2026-03-13 16:06:28 +09:00
sql xml2: Fix failure with xslt_process() under -fsanitize=undefined 2026-03-13 16:06:28 +09:00
.gitignore Support "make check" in contrib 2011-04-25 22:27:11 +03:00
Makefile contrib/xml2: Use SQL-standard function bodies. 2024-12-29 13:53:00 -05:00
meson.build Update copyright for 2026 2026-01-01 13:24:10 -05:00
xml2--1.0--1.1.sql Update xml2 extension for parallel query. 2016-06-14 15:49:32 -04:00
xml2--1.1--1.2.sql contrib/xml2: Use SQL-standard function bodies. 2024-12-29 13:53:00 -05:00
xml2--1.1.sql Update xml2 extension for parallel query. 2016-06-14 15:49:32 -04:00
xml2.control contrib/xml2: Use SQL-standard function bodies. 2024-12-29 13:53:00 -05:00
xpath.c xml2: Fix more memory leaks with libxml2 and XPath evaluations 2026-06-03 08:16:42 +09:00
xslt_proc.c xml2: Fix stylesheet document leak in xslt_process() 2026-06-05 14:29:27 +09:00