Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This function allocates a few ops, then calls Perl_utilize(). If the latter function croaks early on, those ops will be leaked, because they won't yet have been linked into the optree. In particular, newUNOP(OP_REQUIRE, ...) can die if passed a non-valid module name. This can be fixed by moving the start_subparse() call to the start of Perl_vload_module(), before any op allocations. start_subparse() creates a new PL_compcv, and so any ops allocated afterwards will come from that CV's slab rather than being directly malloc()ed. On death, the CV will be freed and its op slab will be scanned and any ops found there freed. The leak was showing up in ext/XS-APItest/t/load-module.t under ASan.
- Loading branch information