You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In git-restore we need to free the pathspec and pathspec_from_file
values from the struct checkout_opts.
A simple fix could be to free them in cmd_restore, after the call to
checkout_main returns, like we are doing [1][2] in the sibling function
cmd_checkout.
However, we can do even better.
We have git-switch and git-restore, both of them spin-offs[3][4] of
git-checkout. All three are implemented as thin wrappers around
checkout_main. Considering this, it makes a lot of sense to do the
cleanup closer to checkout_main.
Move the cleanups, including the new_branch_info variable, to
checkout_main.
As a consequence, mark: t2070, t2071, t2072 and t6418 as leak-free.
[1] 9081a42 (checkout: fix "branch info" memory leaks, 2021-11-16)
[2] 7ce4088 (parse-options: consistently allocate memory in
fix_filename(), 2023-03-04)
[3] d787d31 (checkout: split part of it to new command 'switch',
2019-03-29)
[4] 46e91b6 (checkout: split part of it to new command 'restore',
2019-04-25)
Signed-off-by: Rubén Justo <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
0 commit comments