Please sign in to comment.
Avoid a double free with CORE->lc
The code for autovivifying coresubs for method calls ended up calling hv_store(stash,name,len,(SV *)gv,0) where gv is already in the stash under that entry. Since hv_store takes ownership of one reference count and decrements that of what it overwrites (which is the same gv in this case), it ends up freeing the gv prematurely. It ended up making that call because S_maybe_add_coresub needs the stash to get its ENAME (which happens when called by gv_fetchmeth), but it also assumed that the presence of the stash meant the gv needed to be stored in it (as is the case with the other caller, gv_fetchpvn_flags). This patch reuses the fullen (full length) parameter as a flag to indicate that that hv_store call should be skipped. These workarounds for the assumptions that newATTRSUB makes are start- ing to make inlining look very attractive....
- Loading branch information...