pgsql: jsonapi: fix memory leakage during OOM error recovery.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: jsonapi: fix memory leakage during OOM error recovery.
Date: 2024-09-23 16:30:57
Message-ID: E1sslxh-000Yt4-AU@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2024-09-23 20:03:28 pgsql: Stamp 17.0.
Previous Message Peter Eisentraut 2024-09-23 10:11:44 pgsql: Translation updates