Skip to content

Commit d76260e

Browse files
avargitster
authored andcommitted
submodule--helper: fix trivial get_default_remote_submodule() leak
Fix a leak in code added in 1012a5c (submodule--helper run-update-procedure: learn --remote, 2022-03-04), we need to free() the xstrdup()'d string. This gets e.g. t/t7419-submodule-set-branch.sh closer to passing under SANITIZE=leak. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Reviewed-by: Glen Choo <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e77b3da commit d76260e

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

builtin/submodule--helper.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2448,6 +2448,8 @@ static int update_submodule(struct update_data *update_data)
24482448
return code;
24492449
remote_ref = xstrfmt("refs/remotes/%s/%s", remote_name, branch);
24502450

2451+
free(remote_name);
2452+
24512453
if (!update_data->nofetch) {
24522454
if (fetch_in_submodule(update_data->sm_path, update_data->depth,
24532455
0, NULL))

0 commit comments

Comments
 (0)