diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2022-09-01 01:17:56 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-09-02 18:16:23 +0200 |
commit | 6fac5b2f352efc8c246d6d5be63a66b7b0fc0209 (patch) | |
tree | e905256cffd20b4b95cc330294e74d210205ceea /.github | |
parent | submodule--helper: move "sb" in clone_submodule() to its own scope (diff) | |
download | git-6fac5b2f352efc8c246d6d5be63a66b7b0fc0209.tar.xz git-6fac5b2f352efc8c246d6d5be63a66b7b0fc0209.zip |
submodule--helper: add "const" to passed "module_clone_data"
Add "const" to the "struct module_clone_data" that we pass to
clone_submodule(), which makes the ownership clear, and stops us from
clobbering the "clone_data->path".
We still need to add to the "reference" member, which is a "struct
string_list". Let's do this by having clone_submodule() create its
own, and copy the contents over, allowing us to pass it as a
separate parameter.
This new "struct string_list" still leaks memory, just as the "struct
module_clone_data" did before. let's not fix that for now, to fix that
we'll need to add some "goto cleanup" to the relevant code. That will
eventually be done in follow-up commits, this change makes it easier
to fix the memory leak.
The scope of the new "reference" variable in add_submodule() could be
narrowed to the "else" block, but as we'll eventually free it with a
"goto cleanup" let's declare it at the start of the function.
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 '.github')
0 files changed, 0 insertions, 0 deletions