aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/submodule--helper.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-06-18 13:53:36 -0700
committerJunio C Hamano <gitster@pobox.com>2025-06-18 13:53:36 -0700
commit92daf08c84ef4d324a585f7aa86270f4b1e9900a (patch)
treed13dae4f6c6a2f235bd1c10578c3f431bee2a41e /builtin/submodule--helper.c
parenta6cdbc8f8a1dfc58deb63eaf2772579d1d411a73 (diff)
parentbfc9f9cc6454609e63fefdb95e3dc4f25fcdc8ef (diff)
downloadgit-92daf08c84ef4d324a585f7aa86270f4b1e9900a.tar.gz
Merge branch 'ly/submodule-update-failure-leakfix'
A memory leak on an error code path has been plugged. * ly/submodule-update-failure-leakfix: builtin/submodule--helper: fix leak when remote_submodule_branch() failed
Diffstat (limited to 'builtin/submodule--helper.c')
-rw-r--r--builtin/submodule--helper.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 53da2116dd..640c0059c3 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -2660,8 +2660,10 @@ static int update_submodule(struct update_data *update_data)
if (code)
return code;
code = remote_submodule_branch(update_data->sm_path, &branch);
- if (code)
+ if (code) {
+ free(remote_name);
return code;
+ }
remote_ref = xstrfmt("refs/remotes/%s/%s", remote_name, branch);
free(remote_name);