summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-11-29 21:02:28 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-11-29 21:02:28 +0000
commitb50e026e336896c1a437baf571e9cb02897abacc (patch)
tree1a35287556b6dd4e7e58c7675591bfa090750a99 /src
parent602878d5abe0033b3bf59ac11d5c58bd1f553632 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/pl/plperl/plperl.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index 6caf66e0b55..0a6f8f78616 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -1,7 +1,7 @@
/**********************************************************************
* plperl.c - perl as a procedural language for PostgreSQL
*
- * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.136.2.4 2009/10/31 18:12:12 tgl Exp $
+ * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.136.2.5 2009/11/29 21:02:28 tgl Exp $
*
**********************************************************************/
@@ -1511,11 +1511,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);
}
}