pgsql: Fix some memory leaks associated with parsing json and manifests

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix some memory leaks associated with parsing json and manifests
Date: 2024-04-12 14:59:20
Message-ID: E1rvIN6-001knn-1H@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix some memory leaks associated with parsing json and manifests

Coverity complained about not freeing some memory associated with
incrementally parsing backup manifests. To fix that, provide and use a new
shutdown function for the JsonManifestParseIncrementalState object, in
line with a suggestion from Tom Lane.

While analysing the problem, I noticed a buglet in freeing memory for
incremental json lexers. To fix that remove a bogus condition on
freeing the memory allocated for them.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/661ab4e185784db79c194b5758555b1db3f30483

Modified Files
--------------
src/backend/backup/basebackup_incremental.c | 3 +++
src/bin/pg_combinebackup/load_manifest.c | 3 +++
src/bin/pg_verifybackup/pg_verifybackup.c | 3 +++
src/common/jsonapi.c | 21 ++++++++++-----------
src/common/parse_manifest.c | 13 ++++++++++++-
src/include/common/parse_manifest.h | 1 +
6 files changed, 32 insertions(+), 12 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2024-04-12 16:56:26 pgsql: Document PG_TEST_EXTRA=libpq_encryption and also check 'kerberos
Previous Message David Rowley 2024-04-12 11:16:25 pgsql: Fix recently introduced typo in code comment