summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2001-01-08 23:54:33 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2001-01-08 23:54:33 +0000
commitd460ef459c7692518f607c250b9843bea7e01dd6 (patch)
treecd24ec8713445a650364342ffc6a12cadb0ba9a4 /mg.c
parent372b2723c1b440727154f21dc614ca857f429e6c (diff)
downloadperl-d460ef459c7692518f607c250b9843bea7e01dd6.tar.gz
Fix "scalars leaked" bugs caused by overload magic
(Highlighted by Ilya's DESTROY optimization.) p4raw-id: //depot/perlio@8371
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mg.c b/mg.c
index 99600a4fe7..3a61655678 100644
--- a/mg.c
+++ b/mg.c
@@ -313,11 +313,12 @@ Perl_mg_free(pTHX_ SV *sv)
moremagic = mg->mg_moremagic;
if (vtbl && vtbl->svt_free)
CALL_FPTR(vtbl->svt_free)(aTHX_ sv, mg);
- if (mg->mg_ptr && mg->mg_type != 'g')
+ if (mg->mg_ptr && mg->mg_type != 'g') {
if (mg->mg_len >= 0)
Safefree(mg->mg_ptr);
else if (mg->mg_len == HEf_SVKEY)
SvREFCNT_dec((SV*)mg->mg_ptr);
+ }
if (mg->mg_flags & MGf_REFCOUNTED)
SvREFCNT_dec(mg->mg_obj);
Safefree(mg);
@@ -326,6 +327,7 @@ Perl_mg_free(pTHX_ SV *sv)
return 0;
}
+
#if !defined(NSIG) || defined(M_UNIX) || defined(M_XENIX)
#include <signal.h>
#endif