jsonapi: fix memory leakage during OOM error recovery.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 23 Sep 2024 16:30:51 +0000 (12:30 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 23 Sep 2024 16:30:51 +0000 (12:30 -0400)
commit75240f65e700d7d157be27653c70fe75108f25c1
treec7cd8a40107813461946bcd976a748705cfb7827
parenta7e5237f268ea378c514635d65a55aa47621958a
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.
src/common/jsonapi.c