diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/jsonapi.c | 21 | ||||
-rw-r--r-- | src/common/parse_manifest.c | 13 |
2 files changed, 22 insertions, 12 deletions
diff --git a/src/common/jsonapi.c b/src/common/jsonapi.c index 44dbb7f7f96..9dfbc397c06 100644 --- a/src/common/jsonapi.c +++ b/src/common/jsonapi.c @@ -488,19 +488,18 @@ freeJsonLexContext(JsonLexContext *lex) if (lex->errormsg) destroyStringInfo(lex->errormsg); - if (lex->flags & JSONLEX_FREE_STRUCT) + if (lex->incremental) { - if (lex->incremental) - { - pfree(lex->inc_state->partial_token.data); - pfree(lex->inc_state); - pfree(lex->pstack->prediction); - pfree(lex->pstack->fnames); - pfree(lex->pstack->fnull); - pfree(lex->pstack); - } - pfree(lex); + pfree(lex->inc_state->partial_token.data); + pfree(lex->inc_state); + pfree(lex->pstack->prediction); + pfree(lex->pstack->fnames); + pfree(lex->pstack->fnull); + pfree(lex->pstack); } + + if (lex->flags & JSONLEX_FREE_STRUCT) + pfree(lex); } /* diff --git a/src/common/parse_manifest.c b/src/common/parse_manifest.c index 970a756ce8a..a94e3d6b154 100644 --- a/src/common/parse_manifest.c +++ b/src/common/parse_manifest.c @@ -123,7 +123,6 @@ static bool parse_xlogrecptr(XLogRecPtr *result, char *input); /* * Set up for incremental parsing of the manifest. - * */ JsonManifestParseIncrementalState * @@ -164,6 +163,18 @@ json_parse_manifest_incremental_init(JsonManifestParseContext *context) } /* + * Free an incremental state object and its contents. + */ +void +json_parse_manifest_incremental_shutdown(JsonManifestParseIncrementalState *incstate) +{ + pfree(incstate->sem.semstate); + freeJsonLexContext(&(incstate->lex)); + /* incstate->manifest_ctx has already been freed */ + pfree(incstate); +} + +/* * parse the manifest in pieces. * * The caller must ensure that the final piece contains the final lines |