]> granicus.if.org Git - postgresql/commit
Fix intratransaction memory leaks in xml_recv, xmlconcat, xmlroot, and
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 12 May 2009 20:17:46 +0000 (20:17 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 12 May 2009 20:17:46 +0000 (20:17 +0000)
commit9497c7a744dd8798359ed8db89c8ed6b41e9be76
tree14f2f203153ccd86fbe3944ad39c1d9b59ae28e7
parentdd60bca4b0f21e11db9f46619fca4df8581be894
Fix intratransaction memory leaks in xml_recv, xmlconcat, xmlroot, and
xml_parse, all arising from the same sloppy usage of parse_xml_decl.
The original coding had that function returning its output string
parameters in the libxml context, which is long-lived, and all but one
of its callers neglected to free the strings afterwards.  The easiest
and most bulletproof fix is to return the strings in the local palloc
context instead, since that's short-lived.  This was only costing a
dozen or two bytes per function call, but that adds up fast if the
function is called repeatedly ...

Noted while poking at the more general problem of what to do with our
libxml memory allocation hooks.  Back-patch to 8.3, which has the
identical coding.
src/backend/utils/adt/xml.c