This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix leak in package name lookup
authorDavid Mitchell <davem@iabyn.com>
Tue, 26 Mar 2019 08:56:55 +0000 (08:56 +0000)
committerDavid Mitchell <davem@iabyn.com>
Tue, 26 Mar 2019 08:56:55 +0000 (08:56 +0000)
commit657ed7c1c190e7fad1bac2979944d07245bbeea4
tree7480856165f8332e23579d0feb3c3894360e1f92
parente40cca748f05c81e1929ed625407afbe7c79d4dd
fix leak in package name lookup

S_parse_gv_stash_name() mallocs a temporary buffer when scanning package
names longer than 64 bytes. Depending on how it exits the function, it
doesn't always free the buffer afterwards. Change the function so that
there are only two exit points (which free the buffer) and make other bits
of code goto those two points.

Can be reproduced with e.g.

&{"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'x"}

Similar code is already present in t/op/stash_parse_gv.t
gv.c