diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1998-07-21 00:39:17 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-07-21 00:39:17 +0000 |
commit | da7e89ce5b5c5366c1d9d918e5037309b09415df (patch) | |
tree | b5f011f29d3d216162a4a41e58353a6235d1b112 /perl.c | |
parent | 67ec543f8711d298466404cf8278e57f2908e040 (diff) | |
download | perl-da7e89ce5b5c5366c1d9d918e5037309b09415df.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.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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)); |