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:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-09-02 16:18:13 (GMT)
commitd40c42e06b1bbeab66b6911b864f57407ad68f95 (patch)
treec8b706d2919e37fda5077761bfb55b2ac5aec805 /builtin/submodule--helper.c
parent25b6a95d03fe4fbb7acb8bbd0e1faad9a7f4ea9b (diff)
downloadgit-d40c42e06b1bbeab66b6911b864f57407ad68f95.zip
git-d40c42e06b1bbeab66b6911b864f57407ad68f95.tar.gz
git-d40c42e06b1bbeab66b6911b864f57407ad68f95.tar.bz2
submodule--helper: free some "displaypath" in "struct update_data"
Make the update_data_release() function free "displaypath" member when appropriate. The "displaypath" member is always ours, the "const" on the "char *" was wrong to begin with. This leaves a leak of "displaypath" in update_submodule(), which as we'll see in subsequent commits is harder to deal with than this trivial fix. 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.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 23c4f8d..cc32eb0 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -1877,7 +1877,7 @@ static void submodule_update_clone_release(struct submodule_update_clone *suc)
struct update_data {
const char *prefix;
- const char *displaypath;
+ char *displaypath;
enum submodule_update_type update_default;
struct object_id suboid;
struct string_list references;
@@ -1915,6 +1915,7 @@ struct update_data {
static void update_data_release(struct update_data *ud)
{
+ free(ud->displaypath);
module_list_release(&ud->list);
}