Skip to content

Commit d40c42e

Browse files
avargitster
authored andcommitted
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 <[email protected]> Reviewed-by: Glen Choo <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 25b6a95 commit d40c42e

File tree

4 files changed

+5
-1
lines changed

4 files changed

+5
-1
lines changed

builtin/submodule--helper.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1877,7 +1877,7 @@ static void submodule_update_clone_release(struct submodule_update_clone *suc)
18771877

18781878
struct update_data {
18791879
const char *prefix;
1880-
const char *displaypath;
1880+
char *displaypath;
18811881
enum submodule_update_type update_default;
18821882
struct object_id suboid;
18831883
struct string_list references;
@@ -1915,6 +1915,7 @@ struct update_data {
19151915

19161916
static void update_data_release(struct update_data *ud)
19171917
{
1918+
free(ud->displaypath);
19181919
module_list_release(&ud->list);
19191920
}
19201921

t/t2403-worktree-move.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
test_description='test git worktree move, remove, lock and unlock'
44

5+
TEST_PASSES_SANITIZE_LEAK=true
56
. ./test-lib.sh
67

78
test_expect_success 'setup' '

t/t7412-submodule-absorbgitdirs.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This test verifies that `git submodue absorbgitdirs` moves a submodules git
66
directory into the superproject.
77
'
88

9+
TEST_PASSES_SANITIZE_LEAK=true
910
. ./test-lib.sh
1011

1112
test_expect_success 'setup a real submodule' '

t/t7419-submodule-set-branch.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This test verifies that the set-branch subcommand of git-submodule is working
99
as expected.
1010
'
1111

12+
TEST_PASSES_SANITIZE_LEAK=true
1213
TEST_NO_CREATE_REPO=1
1314
. ./test-lib.sh
1415

0 commit comments

Comments
 (0)