From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: jsonapi: fix memory leakage during OOM error recovery.
Date: Mon, 23 Sep 2024 16:30:57 +0000
Message-ID: <E1sslxh-000Yt4-AU@gemulon.postgresql.org> (raw)
jsonapi: fix memory leakage during OOM error recovery.
Coverity pointed out that inc_lex_level() would leak memory
(not to mention corrupt the pstack data structure) if some
but not all of its three REALLOC's failed. To fix, store
successfully-updated pointers back into the pstack struct
immediately.
Oversight in 0785d1b8b, so no need for back-patch.
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/75240f65e700d7d157be27653c70fe75108f25c1
Modified Files
--------------
src/common/jsonapi.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
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-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: jsonapi: fix memory leakage during OOM error recovery.
In-Reply-To: <E1sslxh-000Yt4-AU@gemulon.postgresql.org>
* 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