Commit bfc9f9c
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>1 parent d50a5e8 commit bfc9f9c
1 file changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2660 | 2660 | | |
2661 | 2661 | | |
2662 | 2662 | | |
2663 | | - | |
| 2663 | + | |
| 2664 | + | |
2664 | 2665 | | |
| 2666 | + | |
2665 | 2667 | | |
2666 | 2668 | | |
2667 | 2669 | | |
| |||
0 commit comments