In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/4b6e9aa6aa2256da1ec7ed08f819cbf5d1463741?hp=8ff713d9d0097d24f522a287d497b801fedd19ce>

- Log -----------------------------------------------------------------
commit 4b6e9aa6aa2256da1ec7ed08f819cbf5d1463741
Author: Sergey Aleynikov <[email protected]>
Date:   Thu Jan 5 01:33:32 2017 +0300

    Fix memory leak in B::RHE->HASH method.
-----------------------------------------------------------------------

Summary of changes:
 ext/B/B.pm    |  2 +-
 ext/B/B.xs    |  2 +-
 t/op/svleak.t | 12 +++++++++++-
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/ext/B/B.pm b/ext/B/B.pm
index 9e58700ebe..ff56fe71e7 100644
--- a/ext/B/B.pm
+++ b/ext/B/B.pm
@@ -15,7 +15,7 @@ require Exporter;
 # walkoptree comes from B.xs
 
 BEGIN {
-    $B::VERSION = '1.66';
+    $B::VERSION = '1.67';
     @B::EXPORT_OK = ();
 
     # Our BOOT code needs $VERSION set, and will append to @EXPORT_OK.
diff --git a/ext/B/B.xs b/ext/B/B.xs
index 5143305bab..310f50d469 100644
--- a/ext/B/B.xs
+++ b/ext/B/B.xs
@@ -2064,7 +2064,7 @@ SV*
 HASH(h)
        B::RHE h
     CODE:
-       RETVAL = newRV( (SV*)cophh_2hv(h, 0) );
+       RETVAL = newRV_noinc( (SV*)cophh_2hv(h, 0) );
     OUTPUT:
        RETVAL
 
diff --git a/t/op/svleak.t b/t/op/svleak.t
index 77ff9ae83b..b949e44476 100644
--- a/t/op/svleak.t
+++ b/t/op/svleak.t
@@ -15,7 +15,7 @@ BEGIN {
 
 use Config;
 
-plan tests => 138;
+plan tests => 139;
 
 # run some code N times. If the number of SVs at the end of loop N is
 # greater than (N-1)*delta at the end of loop 1, we've got a leak
@@ -560,3 +560,13 @@ EOF
     sub f { $a =~ /[^.]+$b/; }
     ::leak(2, 0, \&f, q{use re 'strict' shouldn't leak warning strings});
 }
+
+# check that B::RHE->HASH does not leak
+{
+    package BHINT;
+    sub foo {}
+    require B;
+    my $op = B::svref_2object(\&foo)->ROOT->first;
+    sub lk { { my $d = $op->hints_hash->HASH } }
+    ::leak(3, 0, \&lk, q!B::RHE->HASH shoudln't leak!);
+}

--
Perl5 Master Repository

Reply via email to