diff options
author | Nicholas Clark <nick@ccl4.org> | 2021-09-11 10:47:10 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2021-09-23 15:27:34 +0000 |
commit | d978f0698f3cdb11f60c849e5ec37c62f82c731a (patch) | |
tree | e494de27332b6ebb1fa2daace6a0527c747c47b1 /embed.h | |
parent | 07024caa60f04ae203801d222536bfdad4caf7e8 (diff) | |
download | perl-d978f0698f3cdb11f60c849e5ec37c62f82c731a.tar.gz |
Don't leak in hv_common when croaking about PL_strtab
hv_common can perform read-only actions on PL_strtab, but not write actions.
The code that detects this and croaks had been just after the allocation of
a new HE *, and hence was leaking it. Re-order the code to avoid the leak.
The leak usually wasn't noticeable as HEs are allocated from arenas, and
arenas are correctly freed during full destruction. However, building with
-DPURIFY replaces arenas with individual allocations, making this leak
visible. It's unlikely to have been hit by any production code, but it was
causing leaks during the regression tests.
Also change embed.fnc so that S_new_HE's prototype is not declared under
-DPURIFY, as the static function itself is not defined in this case. This
fixes a compiler warning.
Diffstat (limited to 'embed.h')
-rw-r--r-- | embed.h | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -1565,6 +1565,11 @@ #define utf16_textfilter(a,b,c) S_utf16_textfilter(aTHX_ a,b,c) # endif # endif +# if !defined(PURIFY) +# if defined(PERL_IN_HV_C) +#define new_he() S_new_he(aTHX) +# endif +# endif # if !defined(WIN32) #define do_exec3(a,b,c) Perl_do_exec3(aTHX_ a,b,c) # endif @@ -1695,7 +1700,6 @@ #define hv_free_entries(a) S_hv_free_entries(aTHX_ a) #define hv_magic_check S_hv_magic_check #define hv_notallowed(a,b,c,d) S_hv_notallowed(aTHX_ a,b,c,d) -#define new_he() S_new_he(aTHX) #define ptr_hash S_ptr_hash #define refcounted_he_value(a) S_refcounted_he_value(aTHX_ a) #define save_hek_flags S_save_hek_flags |