public inbox for [email protected]  
help / color / mirror / Atom feed
From: Michael Paquier <[email protected]>
To: Andrey Chernyy <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] xml2: Fix stylesheet document leak in xslt_process()
Date: Fri, 5 Jun 2026 13:53:36 +0900
Message-ID: <[email protected]> (raw)
In-Reply-To: <20260605024642.5a1b6518@andrnote>
References: <20260605024642.5a1b6518@andrnote>

On Fri, Jun 05, 2026 at 02:46:42AM +0300, Andrey Chernyy wrote:
> xslt_process() parses the stylesheet argument with xmlReadMemory(), then
> passes the resulting xmlDoc to xsltParseStylesheetDoc().  On failure,
> libxslt leaves that document owned by the caller, as can be seen from
> its own xsltParseStylesheetFile() wrapper.  Postgres currently cannot
> release it in the error cleanup path because ssdoc is scoped inside the
> PG_TRY block.

In libxslt/xslt.c, the top comment of xsltParseStylesheetDoc() says:
"the doc is automatically freed when the stylesheet is closed."

Reading the code, I can confirm that xsltFreeStylesheet() does a bunch
of stuff, and that it has the idea to call xmlFreeDoc() once at the
end.

Will address this one as well.  Thanks.
--
Michael


Attachments:

  [application/pgp-signature] signature.asc (833B, 2-signature.asc)
  download

view thread (793+ messages)

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: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: [PATCH] xml2: Fix stylesheet document leak in xslt_process()
  In-Reply-To: <[email protected]>

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

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