Perl crashes with ‘double free or corruption’ when using git-svn

If you update git from 1.7 to 1.8.x your git-svn might output a perl backtrace as shown below.

*** Error in `/usr/bin/perl': double free or corruption (!prev): 0x00000000019f4a20 ***
======= Backtrace: =========
======= Memory map: ========
00400000-00402000 r-xp 00000000 08:03 11281949                           /usr/bin/perl
00601000-00602000 r--p 00001000 08:03 11281949                           /usr/bin/perl
00602000-00603000 rw-p 00002000 08:03 11281949                           /usr/bin/perl
007a5000-01a6b000 rw-p 00000000 00:00 0                                  [heap]
7f37f806f000-7f37f8074000 r-xp 00000000 08:03 11275499                   /usr/lib/
7f37f8074000-7f37f8273000 ---p 00005000 08:03 11275499                   /usr/lib/
7f37f8273000-7f37f8274000 r--p 00004000 08:03 11275499                   /usr/lib/

To fix it open /usr/share/perl5/vendor_perl/Git/SVN/ and scroll down to the following section.

        # enforce temporary pool usage for some simple functions
        no strict 'refs';
        for my $f (qw/rev_proplist get_latest_revnum get_uuid get_repos_root
                      get_file/) {
                my $SUPER = "SUPER::$f";
                *$f = sub {
                        my $self = shift;
                        my $pool = SVN::Pool->new;
                        my @ret = $self->$SUPER(@_,$pool);
                        wantarray ? @ret : $ret[0];

sub _auth_providers () {

Now right before the function _auth_providers add

  $RA = undef;

That should solve the problem.

1 Comment

  1. Günther

    This is probably a bug in Perl or in libapr-1 — programming languages with garbage collection should under normal circumstances not have memory corruption errors. — double free is just referring to the fact that someone tried to call free() twice on the same pointer. (See man 3 free for the C memory primitives.)

    Looks like it’s been reported before though:

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>