submodule--helper: fix trivial get_default_remote_submodule() leak

Fix a leak in code added in 1012a5cbc3f (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 <avarab@gmail.com> Reviewed-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Sep 1, 2022 at 01:14 UTC d76260e60a5c0379ca21a26bbded6d6426ae878f
1 file changed +2
builtin/submodule--helper.c
+2
@@ -2448,6 +2448,8 @@ static int update_submodule(struct update_data *update_data)
2448 return code;
2449 remote_ref = xstrfmt("refs/remotes/%s/%s", remote_name, branch);
2450
2451 + free(remote_name);
2452 +
2453 if (!update_data->nofetch) {
2454 if (fetch_in_submodule(update_data->sm_path, update_data->depth,
2455 0, NULL))