diff options
author | David Mitchell <davem@iabyn.com> | 2023-01-11 13:13:36 +0000 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2023-02-28 20:53:51 +0800 |
commit | e59c0ae3bee1fdc875ad714006af9072efee840a (patch) | |
tree | f8a1aa17aef0a9e34acaabbffc50765b6beaa2aa | |
parent | 782514efb3d0b2cb91b55f2ac00c89940e973417 (diff) | |
download | perl-e59c0ae3bee1fdc875ad714006af9072efee840a.tar.gz |
NULL sv->sv_debug_file when freed
This field is used on DEBUG_LEAKING_SCALARS builds to track the file
where the SV was allocated. When freeing the SV, the string was
freed but the pointer was left pointing at the freed string.
So NULL it out.
-rw-r--r-- | sv.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -231,7 +231,10 @@ Public API: #ifdef DEBUG_LEAKING_SCALARS # define FREE_SV_DEBUG_FILE(sv) STMT_START { \ - if ((sv)->sv_debug_file) PerlMemShared_free((sv)->sv_debug_file); \ + if ((sv)->sv_debug_file) { \ + PerlMemShared_free((sv)->sv_debug_file); \ + sv->sv_debug_file = NULL; \ + } \ } STMT_END # define DEBUG_SV_SERIAL(sv) \ DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%" UVxf ": (%05ld) del_SV\n", \ |