summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-07-21 00:39:17 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-07-21 00:39:17 +0000
commit9c63ababe730a679456af7dbae670cea805c3751 (patch)
treeb5f011f29d3d216162a4a41e58353a6235d1b112 /perl.c
parented6c1d6b44d8ffac74beba8dcd7c0393a8698b0d (diff)
downloadperl-9c63ababe730a679456af7dbae670cea805c3751.tar.gz
fix small memory leak when mess_sv happens to be touched by magic
p4raw-id: //depot/perl@1585
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/perl.c b/perl.c
index bebcb02a59..df306dc0e1 100644
--- a/perl.c
+++ b/perl.c
@@ -567,6 +567,17 @@ perl_destruct(register PerlInterpreter *sv_interp)
/* As the absolutely last thing, free the non-arena SV for mess() */
if (PL_mess_sv) {
+ /* it could have accumulated taint magic */
+ if (SvTYPE(PL_mess_sv) >= SVt_PVMG) {
+ MAGIC* mg;
+ MAGIC* moremagic;
+ for (mg = SvMAGIC(PL_mess_sv); mg; mg = moremagic) {
+ moremagic = mg->mg_moremagic;
+ if (mg->mg_ptr && mg->mg_type != 'g' && mg->mg_len >= 0)
+ Safefree(mg->mg_ptr);
+ Safefree(mg);
+ }
+ }
/* we know that type >= SVt_PV */
SvOOK_off(PL_mess_sv);
Safefree(SvPVX(PL_mess_sv));