diff options
author | Lidong Yan <502024330056@smail.nju.edu.cn> | 2025-06-08 03:56:59 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2025-06-08 08:49:48 -0700 |
commit | bfc9f9cc6454609e63fefdb95e3dc4f25fcdc8ef (patch) | |
tree | 6ee58c8f09a8d7ba94fdc7b2f44368fa7bc96593 /commit.c | |
parent | d50a5e8939abfc07c2ff97ae72e9330939b36ee0 (diff) |
builtin/submodule--helper: fix leak when remote_submodule_branch() failed
In builtin/submodule--helper.c:update_submodule(), the variable
remote_name is allocated in get_default_remote_submodule() but
may be leaked if remote_submodule_branch() fails. Although it is
unlikely that remote_submodule_branch() would fail after successfully
obtaining a remote ref name from get_default_remote_submodule(),
it is still possible. To prevent a potential memory leak, add a
call to free(remote_name) at the early exit point.
Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
0 files changed, 0 insertions, 0 deletions