aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/submodule--helper.c
diff options
context:
space:
mode:
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 c1a8029714..c5f2863b55 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);