]> granicus.if.org Git - postgresql/commit
Fix I/O-conversion-related memory leaks in plpgsql.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 11 Feb 2012 23:06:29 +0000 (18:06 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 11 Feb 2012 23:06:29 +0000 (18:06 -0500)
commit6fb17aeeab87dafca42a9db49ecb152a967d155c
tree804b16152188ae35832cd3a194240cbbd7958a8d
parentdd4e0a38781e0c48409f0c092b04b2ec75ed1a7e
Fix I/O-conversion-related memory leaks in plpgsql.

Datatype I/O functions are allowed to leak memory in CurrentMemoryContext,
since they are generally called in short-lived contexts.  However, plpgsql
calls such functions for purposes of type conversion, and was calling them
in its procedure context.  Therefore, any leaked memory would not be
recovered until the end of the plpgsql function.  If such a conversion
was done within a loop, quite a bit of memory could get consumed.  Fix by
calling such functions in the transient "eval_econtext", and adjust other
logic to match.  Back-patch to all supported versions.

Andres Freund, Jan UrbaƄski, Tom Lane
src/pl/plpgsql/src/pl_exec.c