[PATCH 1/5] pack-objects: plug leak in `read_stdin_packs()`
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Mar 19, 2026, 22:24 UTC
- Message-ID
- <1dac74f1e4a370097117754a6b1fbb6fa2b382a6.1773959041.git.me@ttaylorr.com>
- In-Reply-To
- <cover.1773959041.git.me@ttaylorr.com>
The `read_stdin_packs()` function added originally via 339bce27f4f (builtin/pack-objects.c: add '--stdin-packs' option, 2021-02-22) declares a `rev_info` struct but neglects to call `release_revisions()` on it before returning, creating a leak.
The related change in 97ec43247c0 (pack-objects: declare 'rev_info' for '--stdin-packs' earlier, 2025-06-23) carried forward this oversight and did not address it.
Ensure that we call `release_revisions()` appropriately to prevent a leak from this function.
Signed-off-by: Taylor Blau <me@ttaylorr.com> --- builtin/pack-objects.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index cd013c0b68a..9a89bc5c4c9 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -3968,6 +3968,8 @@ static void read_stdin_packs(enum stdin_packs_mode mode, int rev_list_unpacked) show_object_pack_hint, &mode); + release_revisions(&revs); + trace2_data_intmax("pack-objects", the_repository, "stdin_packs_found", stdin_packs_found_nr); trace2_data_intmax("pack-objects", the_repository, "stdin_packs_hints",
-- 2.53.0.614.gc4fd52e751a