From cdfbb78f041676a3a597365abacb2a503e204baa Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Mon, 3 Feb 2014 10:39:13 -0500 Subject: [PATCH] In json code, clean up temp memory contexts after processing. Craig Ringer. --- src/backend/utils/adt/jsonfuncs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c index bcb9354364..cf66a28cf2 100644 --- a/src/backend/utils/adt/jsonfuncs.c +++ b/src/backend/utils/adt/jsonfuncs.c @@ -958,6 +958,8 @@ each_worker(PG_FUNCTION_ARGS, bool as_text) pg_parse_json(lex, sem); + MemoryContextDelete(state->tmp_cxt); + rsi->setResult = state->tuple_store; rsi->setDesc = state->ret_tdesc; @@ -1125,6 +1127,8 @@ json_array_elements(PG_FUNCTION_ARGS) pg_parse_json(lex, sem); + MemoryContextDelete(state->tmp_cxt); + rsi->setResult = state->tuple_store; rsi->setDesc = state->ret_tdesc;