Skip to content
Snippets Groups Projects
Commit 67ec9ada authored by Tom Lane's avatar Tom Lane
Browse files

Fix session-lifespan memory leak when a plperl function is redefined:

we have to tell Perl it can release its compiled copy of the function
text.  Noted by Alexey Klyukin.

Back-patch to 8.2 --- the problem exists further back, but this patch
won't work without modification, and it's probably not worth the trouble.
parent 22032820
No related branches found
No related tags found
No related merge requests found
/**********************************************************************
* plperl.c - perl as a procedural language for PostgreSQL
*
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.154 2009/11/29 03:02:27 tgl Exp $
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.155 2009/11/29 21:02:16 tgl Exp $
*
**********************************************************************/
......@@ -1651,11 +1651,13 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
if (!uptodate)
{
hash_search(plperl_proc_hash, internal_proname,
HASH_REMOVE, NULL);
if (prodesc->reference)
SvREFCNT_dec(prodesc->reference);
free(prodesc->proname);
free(prodesc);
prodesc = NULL;
hash_search(plperl_proc_hash, internal_proname,
HASH_REMOVE, NULL);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment