Merge branch 'sp/maint-plug-traverse-commit-list-leak' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 12 Nov 2007 08:00:00 +0000 (00:00 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 12 Nov 2007 08:00:00 +0000 (00:00 -0800)
* sp/maint-plug-traverse-commit-list-leak:
  Fix memory leak in traverse_commit_list

list-objects.c

index e5c88c2..4ef58e7 100644 (file)
@@ -170,4 +170,11 @@ void traverse_commit_list(struct rev_info *revs,
        }
        for (i = 0; i < objects.nr; i++)
                show_object(&objects.objects[i]);
+       free(objects.objects);
+       if (revs->pending.nr) {
+               free(revs->pending.objects);
+               revs->pending.nr = 0;
+               revs->pending.alloc = 0;
+               revs->pending.objects = NULL;
+       }
 }