summaryrefslogtreecommitdiff
path: root/builtin/submodule--helper.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-08-31 23:14:09 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-09-02 16:18:12 (GMT)
commitd76260e60a5c0379ca21a26bbded6d6426ae878f (patch)
tree35e33b5a4f53e8d6193e995d049fe2378ac69de3 /builtin/submodule--helper.c
parente77b3da6bb60e9af5963c9e42442afe53af1780b (diff)
downloadgit-d76260e60a5c0379ca21a26bbded6d6426ae878f.zip
git-d76260e60a5c0379ca21a26bbded6d6426ae878f.tar.gz
git-d76260e60a5c0379ca21a26bbded6d6426ae878f.tar.bz2
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>
Diffstat (limited to 'builtin/submodule--helper.c')
-rw-r--r--builtin/submodule--helper.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index d308b14..d46ba10 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -2448,6 +2448,8 @@ static int update_submodule(struct update_data *update_data)
return code;
remote_ref = xstrfmt("refs/remotes/%s/%s", remote_name, branch);
+ free(remote_name);
+
if (!update_data->nofetch) {
if (fetch_in_submodule(update_data->sm_path, update_data->depth,
0, NULL))