]> git.ipfire.org Git - thirdparty/git.git/commitdiff
pack-bitmap: plug leak in find_objects()
authorTaylor Blau <me@ttaylorr.com>
Thu, 14 Dec 2023 22:23:45 +0000 (17:23 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 14 Dec 2023 22:38:07 +0000 (14:38 -0800)
The `find_objects()` function creates an object_list for any tips of the
reachability query which do not have corresponding bitmaps.

The object_list is not used outside of `find_objects()`, but we never
free it with `object_list_free()`, resulting in a leak. Let's plug that
leak by calling `object_list_free()`, which results in t6113 becoming
leak-free.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
pack-bitmap.c
t/t6113-rev-list-bitmap-filters.sh

index 0260890341b5a36af3ee1ec248282e2f1f1ebc53..d2f13069603106983e75205c4fa60d1579696f96 100644 (file)
@@ -1280,6 +1280,8 @@ static struct bitmap *find_objects(struct bitmap_index *bitmap_git,
                base = fill_in_bitmap(bitmap_git, revs, base, seen);
        }
 
+       object_list_free(&not_mapped);
+
        return base;
 }
 
index 86c70521f1db7184e70c1eb6baf17883ecc6609f..459f0d741225522276b84a9a65caaa2e2a985bde 100755 (executable)
@@ -4,6 +4,8 @@ test_description='rev-list combining bitmaps and filters'
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-bitmap.sh
 
+TEST_PASSES_SANITIZE_LEAK=true
+
 test_expect_success 'set up bitmapped repo' '
        # one commit will have bitmaps, the other will not
        test_commit one &&