summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2023-01-11 13:13:36 +0000
committerYves Orton <demerphq@gmail.com>2023-02-28 20:53:51 +0800
commite59c0ae3bee1fdc875ad714006af9072efee840a (patch)
treef8a1aa17aef0a9e34acaabbffc50765b6beaa2aa
parent782514efb3d0b2cb91b55f2ac00c89940e973417 (diff)
downloadperl-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.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sv.c b/sv.c
index a4290d92b3..5a7e319720 100644
--- a/sv.c
+++ b/sv.c
@@ -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", \