Fix leaking arguments passed to Perl 5 functions
Fix leaking array contents passed to Perl 5