Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Further fix thinko in plpgsql memory leak fix.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 28 Dec 2020 16:55:23 +0000 (11:55 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 28 Dec 2020 16:55:37 +0000 (11:55 -0500)
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

index e0c49c1e26648e3dfcd0e04db5ab6574a6b63900..d380e2ec61d9b07316ba3baad4ad00486f1804fc 100644 (file)
@@ -2259,7 +2259,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