Branch: refs/heads/fix-static-COW-leak
  Home:   https://github.com/Perl/perl5
  Commit: 883a9955139677c4ded5a6cc73a67ef12c1d3cb0
      
https://github.com/Perl/perl5/commit/883a9955139677c4ded5a6cc73a67ef12c1d3cb0
  Author: Nicholas Clark <n...@ccl4.org>
  Date:   2021-09-11 (Sat, 11 Sep 2021)

  Changed paths:
    M sv.c

  Log Message:
  -----------
  Fix a leak when copying a STATIC COW SV to a stringified SV

This is minor a a regression introduced by commit 914bb57489325d34:
    Define a third kind of COW state; STATIC

    ...

    sv_setsv_flags() and sv_setsv_cow() will preserve this state

There was a small omission in the copy code - it didn't handle the case where
the destination SV owned a string buffer already. This is actually
relatively rare - triggering it requires a scalar in code path that is
assigned both strings and booleans. Minimal test case is:

    my $got = 1;
    $got .= "";
    $got = ref "";

cut down from &is in t/comp/parser.t


Reply via email to