]> git.99rst.org Git - git.git/commitdiff
repack: free existing_cruft array after use
authorJeff King <redacted>
Sat, 7 Oct 2023 17:20:31 +0000 (13:20 -0400)
committerJunio C Hamano <redacted>
Mon, 9 Oct 2023 17:27:34 +0000 (10:27 -0700)
We allocate an array of packed_git pointers so that we can sort the list
of cruft packs, but we never free the array, causing a small leak. Note
that we don't need to free the packed_git structs themselves; they're
owned by the repository object.

Signed-off-by: Jeff King <redacted>
Acked-by: Taylor Blau <redacted>
Signed-off-by: Junio C Hamano <redacted>
builtin/repack.c

index a1a893d9524fd175bfe0793f5e1e0e0aea3a3947..69e8f302c0079658955011c1d1db7ad13a9b0579 100644 (file)
@@ -955,6 +955,7 @@ static void collapse_small_cruft_packs(FILE *in, size_t max_size,
                        existing->non_kept_packs.items[i].string);
 
        strbuf_release(&buf);
+       free(existing_cruft);
 }
 
 static int write_cruft_pack(const struct pack_objects_args *args,
git clone https://git.99rst.org/PROJECT