summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Ævar Arnfjörð Bjarmason <avarab@gmail.com>2021-10-22 10:55:43 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-10-23 10:45:25 -0700
commitc270b055d94b643b0ac8bcb390b82330aee01a34 (patch)
treeb7ebb3f6453003616a4e48dcbe64d8996d8fe037 /builtin
parentclone: fix a memory leak of the "git_dir" variable (diff)
downloadtgif-c270b055d94b643b0ac8bcb390b82330aee01a34.tar.xz
submodule--helper: fix small memory leaks
Add a missing strbuf_release() and a clear_pathspec() to the submodule--helper. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-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 6298cbdd4e..a157656a48 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -3220,6 +3220,7 @@ static void die_on_index_match(const char *path, int force)
}
free(ps_matched);
}
+ clear_pathspec(&ps);
}
static void die_on_repo_without_commits(const char *path)
@@ -3231,6 +3232,7 @@ static void die_on_repo_without_commits(const char *path)
if (resolve_gitlink_ref(path, "HEAD", &oid) < 0)
die(_("'%s' does not have a commit checked out"), path);
}
+ strbuf_release(&sb);
}
static int module_add(int argc, const char **argv, const char *prefix)