This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix memory leak in generating an exception message
authorAaron Crane <arc@cpan.org>
Sat, 4 Feb 2017 15:28:19 +0000 (15:28 +0000)
committerAaron Crane <arc@cpan.org>
Sat, 4 Feb 2017 15:28:47 +0000 (15:28 +0000)
This was my fault; oops.

pp_sys.c

index 7c125b5..9874107 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -960,7 +960,7 @@ PP(pp_tie)
                /* If the glob doesn't name an existing package, using
                 * SVfARG(*MARK) would yield "*Foo::Bar" or *main::Foo. So
                 * generate the name for the error message explicitly. */
-               SV *stashname = newSV(0);
+               SV *stashname = sv_2mortal(newSV(0));
                gv_fullname4(stashname, (GV *) *MARK, NULL, FALSE);
                DIE(aTHX_ "Can't locate object method \"%s\" via package \"%" SVf "\"",
                    methname, SVfARG(stashname));