diff options
author | Radu Greab <radu@netsoft.ro> | 2002-06-08 11:28:58 +0300 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-06-08 11:37:56 +0000 |
commit | 10ffa93f5cc3b0e0d3413470ba26154d1c6294a0 (patch) | |
tree | bd2d1ea39898d2c8c61c45e2434a5222d1470456 /ext | |
parent | c7d80bde0ff1cc98e894e948c628e3ce79d7115f (diff) | |
download | perl-10ffa93f5cc3b0e0d3413470ba26154d1c6294a0.tar.gz |
Re: [ID 20020601.005] Storable: STORABLE_freeze mechanism leaks memory (unfreed SVs)
Message-ID: <15617.38426.603787.918922@ix.netsoft.ro>
p4raw-id: //depot/perl@17082
Diffstat (limited to 'ext')
-rw-r--r-- | ext/Storable/Storable.xs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/Storable/Storable.xs b/ext/Storable/Storable.xs index 625cdcad17..7e7da22d97 100644 --- a/ext/Storable/Storable.xs +++ b/ext/Storable/Storable.xs @@ -2645,7 +2645,7 @@ static int store_hook( * If they returned more than one item, we need to serialize some * extra references if not already done. * - * Loop over the array, starting at postion #1, and for each item, + * Loop over the array, starting at position #1, and for each item, * ensure it is a reference, serialize it if not already done, and * replace the entry with the tag ID of the corresponding serialized * object. @@ -3677,6 +3677,10 @@ static SV *retrieve_hook(stcxt_t *cxt, char *cname) * We don't need to remember the addresses returned by retrieval, because * all the references will be obtained through indirection via the object * tags in the object-ID list. + * + * We need to decrement the reference count for these objects + * because, if the user doesn't save a reference to them in the hook, + * they must be freed when this context is cleaned. */ while (flags & SHF_NEED_RECURSE) { @@ -3684,6 +3688,7 @@ static SV *retrieve_hook(stcxt_t *cxt, char *cname) rv = retrieve(cxt, 0); if (!rv) return (SV *) 0; + SvREFCNT_dec(rv); TRACEME(("retrieve_hook back with rv=0x%"UVxf, PTR2UV(rv))); GETMARK(flags); |