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 | 9c63ababe730a679456af7dbae670cea805c3751 (patch) | |
tree | b5f011f29d3d216162a4a41e58353a6235d1b112 /perl.c | |
parent | ed6c1d6b44d8ffac74beba8dcd7c0393a8698b0d (diff) | |
download | perl-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.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)); |