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

Started by Andrew Dunstanabout 2 years ago1 messagescomitters
Jump to latest
#1Andrew Dunstan
andrew@dunslane.net

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