Subject: [PATCH] memory leak reported by valgrind

From: Ivan Kanis <[email-masked]>
Date: Mon, 09 Aug 2010 11:48:45 +0200

Hello,

This patches the following memory leak reported by valgrind:

512 bytes in 1 blocks are definitely lost in loss record 5 of 8
  at 0x4C203E4: calloc (vg_replace_malloc.c:397)
  by 0x4C5F9D: xcalloc (wrapper.c:96)
  by 0x445741: cmd_pack_objects (pack-objects.c:2117)
  by 0x4048EE: handle_internal_command (git.c:270)
  by 0x404B03: main (git.c:470)

diff -u git-1.7.2.1/builtin/pack-objects.c git.ivan/builtin/pack-objects.c
--- git-1.7.2.1/builtin/pack-objects.c  2010-07-28 19:03:43.000000000 +0200
+++ git.ivan/builtin/pack-objects.c     2010-08-09 11:38:40.000000000 +0200
@@ -2341,5 +2341,6 @@
                fprintf(stderr, "Total %"PRIu32" (delta %"PRIu32"),"
                        " reused %"PRIu32" (delta %"PRIu32")\n",
                        written, written_delta, reused, reused_delta);
+       free(rp_av);
        return 0;
 }

-- 
Ivan Kanis

When you're looking at life
In a strange new room
Maybe drowning soon
Is this the start of it all?
    -- Ian Curtis