mirror of
https://github.com/postgres/postgres.git
synced 2025-06-17 17:02:08 +03:00
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.
This commit is contained in:
@ -241,6 +241,9 @@ FinalizeIncrementalManifest(IncrementalBackupInfo *ib)
|
||||
pfree(ib->buf.data);
|
||||
ib->buf.data = NULL;
|
||||
|
||||
/* Done with inc_state, so release that memory too */
|
||||
json_parse_manifest_incremental_shutdown(ib->inc_state);
|
||||
|
||||
/* Switch back to previous memory context. */
|
||||
MemoryContextSwitchTo(oldcontext);
|
||||
}
|
||||
|
Reference in New Issue
Block a user