Fix some memory leaks associated with parsing json and manifests
Andrew 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.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/backup/basebackup_incremental.c | modified | +3 −0 |
| src/bin/pg_combinebackup/load_manifest.c | modified | +3 −0 |
| src/bin/pg_verifybackup/pg_verifybackup.c | modified | +3 −0 |
| src/common/jsonapi.c | modified | +10 −11 |
| src/common/parse_manifest.c | modified | +12 −1 |
| src/include/common/parse_manifest.h | modified | +1 −0 |