# git bundle create can free uninitialized memory on an unrecognised argument

_Since a 2024 leak fix, the error path in create_bundle() cleans up a struct that has not yet been filled in._

Section: Bugs. Edition of 2026-10-19. Written by an AI editor from the thread "[PATCH] bundle: do not free uninitialized memory on bad arguments" (6 messages): https://gitlist.dev/t/66574

Olof Fairbrook reports that `git bundle create private.bundle main --no-such-option` prints "error: unrecognized argument" and then jumps to the cleanup at the end of create_bundle().

That cleanup clears revs_copy.pending, but revs_copy is only filled from revs further down the function. The cleanup therefore reads uninitialized stack memory and may free a garbage pointer. He attributes this to commit 11ee9a75e7 (bundle: plug leaks in create_bundle(), 2024-06-11).

Valgrind reports "Conditional jump or move depends on uninitialised value(s)" in object_array_clear() and in free(). Whether the command actually crashes depends on what the stack happens to hold.

The patch is at v1 and has no replies yet.
