pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jim Jones <jim.jones@uni-muenster.de>
Cc: Peter Smith <smithpb2250@gmail.com>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: Nikolay Samokhvalov <samokhvalov@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Andrey Borodin <amborodin86@gmail.com>
Subject: Re: [PATCH] Add pretty-printed XML output option
Date: Wed, 21 May 2025 19:48:05 -0400
Message-ID: <1418827.1747871285@sss.pgh.pa.us> (raw)
In-Reply-To: <552cf981-643e-417b-88f4-1476c1320c36@uni-muenster.de>
References: <2f5df461-dad8-6d7d-4568-08e10608a69b@uni-muenster.de>
	<2eac4d78-2b20-e8ec-54cc-22a88653a1cc@uni-muenster.de>
	<CAHut+PsgXxbzzsG+VqHUa4Kz3G4B-anNmF3-GENwuUdfMJtowA@mail.gmail.com>
	<fb2a543b-e615-d9ba-8402-909631f9b212@uni-muenster.de>
	<CAHut+Pvryt_+wA7TwKVaaF0e6Pm5LaPZQLKatp=78oFd8vMh3A@mail.gmail.com>
	<6cb296fe-4b49-3691-633e-2e2366997b04@uni-muenster.de>
	<3baf8f25-3bd7-7db5-0b31-e4c92b6269ba@enterprisedb.com>
	<1cbe1087-6acb-2b0a-dc9b-0a2d5b99e466@uni-muenster.de>
	<CAHut+PvBUTf9p+Y6+mpWpz59=3eL_EKQ+7Ysxpa9hYGdncDMdg@mail.gmail.com>
	<532259.1678393296@sss.pgh.pa.us>
	<906cfd1d-63a0-3cf5-7291-2dadb2e! 149ff@uni-muenster.de>
	<803304.1678458776@sss.pgh.pa.us>
	<efe0b19b-! d41c-f8ab-f3b8-afb0108f3706@uni-muenster.de>
	<2752578.1678815625@sss.pgh.pa.us>
	<abd25443-ef6d-7b8a-c593-a2a991d3e5ce@uni-! ! muenster.de>
	<3057762.1678836321@sss.pgh.pa.us>
	<3622266.1678914816@sss.pgh.pa.us>
	<1c7cf9f0-14c3-0341-6894! -8ca577bf325e@uni-muenster.de>
	<1358967.1747858817@sss.pgh.pa.us>
	<! 552cf981-643e-417b-88f4-1476c1320c36@uni-muenster.de>

Jim Jones <jim.jones@uni-muenster.de> writes:
> On 21.05.25 22:20, Tom Lane wrote:
>> It turns out that xmlDocSetRootElement() doesn't
>> merely install the given root node: it unlinks the document's old
>> root node and returns it to you.  If you don't free it, it's leaked
>> (for the session, since this is a malloc not palloc).

> The xmlsoft examples are a bit misleading though [1]

Yeah.  I also did some searching on http://codesearch.debian.net
and was hard put to it to find anything that pays attention to
xmlDocSetRootElement's result at all.  I wonder how many of those
represent leaks.

> It seems that xml_parse has the same issue[3]

I did look at that one too.  I think it's fine, because we're
dealing with a newly-created document which can't have a root node
yet.  (Reinforcing this, Valgrind sees no leaks after applying
my patch.)  I considered adding an assertion that that call returns
NULL, but concluded that it wasn't worth the notational hassle.
I'm not strongly set on that conclusion, though, if you think
differently.

			regards, tom lane





view thread (70+ messages)  latest in thread

Message-ID: <1418827.1747871285@sss.pgh.pa.us>
Permalink:  ../1418827.1747871285@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1418827.1747871285@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jim.jones@uni-muenster.de, smithpb2250@gmail.com, peter.eisentraut@enterprisedb.com, samokhvalov@gmail.com, pgsql-hackers@lists.postgresql.org, amborodin86@gmail.com
  Subject: Re: [PATCH] Add pretty-printed XML output option
  In-Reply-To: <1418827.1747871285@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox