Fix some memory leaks associated with parsing json and manifests
authorAndrew Dunstan <andrew@dunslane.net>
Tue, 9 Apr 2024 13:07:14 +0000 (09:07 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Fri, 12 Apr 2024 14:32:30 +0000 (10:32 -0400)
commit661ab4e185784db79c194b5758555b1db3f30483
treec5fdde1cecca9ea8440f5e8e2412741acc34d580
parentb9ecefecc7aaad117e0255b56b759f524f0f4363
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.
src/backend/backup/basebackup_incremental.c
src/bin/pg_combinebackup/load_manifest.c
src/bin/pg_verifybackup/pg_verifybackup.c
src/common/jsonapi.c
src/common/parse_manifest.c
src/include/common/parse_manifest.h