Skip to content

Commit 92daf08

Browse files
committed
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
2 parents a6cdbc8 + bfc9f9c commit 92daf08

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

builtin/submodule--helper.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2660,8 +2660,10 @@ static int update_submodule(struct update_data *update_data)
26602660
if (code)
26612661
return code;
26622662
code = remote_submodule_branch(update_data->sm_path, &branch);
2663-
if (code)
2663+
if (code) {
2664+
free(remote_name);
26642665
return code;
2666+
}
26652667
remote_ref = xstrfmt("refs/remotes/%s/%s", remote_name, branch);
26662668

26672669
free(remote_name);

0 commit comments

Comments
 (0)