Skip to content

Commit 67ec9ad

Browse files
committed
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.
1 parent 2203282 commit 67ec9ad

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/pl/plperl/plperl.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**********************************************************************
22
* plperl.c - perl as a procedural language for PostgreSQL
33
*
4-
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.154 2009/11/29 03:02:27 tgl Exp $
4+
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.155 2009/11/29 21:02:16 tgl Exp $
55
*
66
**********************************************************************/
77

@@ -1651,11 +1651,13 @@ compile_plperl_function(Oid fn_oid, bool is_trigger)
16511651

16521652
if (!uptodate)
16531653
{
1654+
hash_search(plperl_proc_hash, internal_proname,
1655+
HASH_REMOVE, NULL);
1656+
if (prodesc->reference)
1657+
SvREFCNT_dec(prodesc->reference);
16541658
free(prodesc->proname);
16551659
free(prodesc);
16561660
prodesc = NULL;
1657-
hash_search(plperl_proc_hash, internal_proname,
1658-
HASH_REMOVE, NULL);
16591661
}
16601662
}
16611663

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy