submodule: set a default to the iterator The iterator is always freed, but not always initialized first.
diff --git a/src/submodule.c b/src/submodule.c index fc3dcb4..0db58f4 100644 --- a/src/submodule.c +++ b/src/submodule.c
@@ -401,9 +401,10 @@ static int submodules_from_head(git_strmap *map, git_tree *head, git_config *cfg) { int error; - git_iterator *i; + git_iterator *i = NULL; const git_index_entry *entry; git_strmap *names = 0; + git_strmap_alloc(&names); if ((error = load_submodule_names(names, cfg))) goto done;