diff options
| author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2026-07-05 08:24:25 +0000 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-07-05 09:12:10 -0700 |
| commit | da2211be7461762a47b67449cc3a518b8942ec84 (patch) | |
| tree | 1b72405e4a46d01531a5d32b9a6d245504e19e43 /t/t4013/diff.diff_initial..side | |
| parent | add15d11ac1d882fe1a36e3f7a936fb92943ecca (diff) | |
worktree: fix resource leaks when branch creation fails
In the "add" subcommand, when `run_command()` fails while creating a new
branch (line 948), the function returns -1 immediately without freeing
the allocations made earlier: path (from prefix_filename at line 858),
opt_track, branch_to_free, and new_branch_to_free.
Redirect the error return through the existing cleanup block at the end
of the function so all four allocations are properly freed.
Pointed out by Coverity.
Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4013/diff.diff_initial..side')
0 files changed, 0 insertions, 0 deletions
