diff options
| author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2022-09-01 01:14:10 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-09-02 09:18:12 -0700 |
| commit | 8fb201d4da0e9244f44dabdb1a5f5ea2809b2270 (patch) | |
| tree | be9f1778c6f3371c8c2bacb83212593e53af21cf /builtin/repack.c | |
| parent | d76260e60a5c0379ca21a26bbded6d6426ae878f (diff) | |
| download | git-8fb201d4da0e9244f44dabdb1a5f5ea2809b2270.tar.gz | |
submodule--helper: fix most "struct pathspec" memory leaks
Call clear_pathspec() at the end of various functions that work with
and allocate a "struct pathspec".
In some cases the zero-initialization here isn't strictly needed, but
as we're moving to a "goto cleanup" pattern let's make sure that it's
safe to call clear_pathspec(), we don't want the data to be
uninitialized.
E.g. for module_foreach() we can see from looking at
module_list_compute() that if it returns non-zero that the "pathspec"
will always have been initialized. But relying on that both assumes
knowledge about parse_pathspec(), and would set up a fragile pattern
going forward.
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/repack.c')
0 files changed, 0 insertions, 0 deletions
