From 7966b41ded75c9c5f19b827d6d36f9408ca121a2 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 28 Dec 2020 11:55:23 -0500 Subject: [PATCH] Further fix thinko in plpgsql memory leak fix. There's a second call of get_eval_mcontext() that should also be get_stmt_mcontext(). This is actually dead code, since no interesting allocations happen before switching back to the original context, but we should keep it in sync with the other call to forestall possible future bugs. Discussion: https://postgr.es/m/f075f7be-c654-9aa8-3ffc-e9214622f02a@enterprisedb.com --- src/pl/plpgsql/src/pl_exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c index b876caaee2..19da13678a 100644 --- a/src/pl/plpgsql/src/pl_exec.c +++ b/src/pl/plpgsql/src/pl_exec.c @@ -2239,7 +2239,7 @@ exec_stmt_call(PLpgSQL_execstate *estate, PLpgSQL_stmt_call *stmt) row->varnos = (int *) palloc(sizeof(int) * list_length(funcargs)); if (!local_plan) - MemoryContextSwitchTo(get_eval_mcontext(estate)); + MemoryContextSwitchTo(get_stmt_mcontext(estate)); /* * Examine procedure's argument list. Each output arg position