mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-05 15:33:51 +00:00
config: fix leaks in the iterators
This commit is contained in:
parent
1e96c9d534
commit
a319ffaead
@ -594,6 +594,7 @@ int git_config_get_multivar_foreach(
|
||||
}
|
||||
}
|
||||
|
||||
iter->free(iter);
|
||||
if (err == GIT_ITEROVER)
|
||||
err = 0;
|
||||
|
||||
@ -661,6 +662,10 @@ static int multivar_iter_next(git_config_entry **entry, git_config_iterator *_it
|
||||
backend = internal->file;
|
||||
iter->i = i - 1;
|
||||
|
||||
if (iter->current)
|
||||
iter->current->free(current);
|
||||
|
||||
iter->current = NULL;
|
||||
error = backend->get_multivar(&iter->current, backend, iter->name, iter->regexp);
|
||||
if (error == GIT_ENOTFOUND)
|
||||
continue;
|
||||
@ -679,6 +684,9 @@ void multivar_iter_free(git_config_iterator *_iter)
|
||||
{
|
||||
multivar_iter *iter = (multivar_iter *) _iter;
|
||||
|
||||
if (iter->current)
|
||||
iter->current->free(iter->current);
|
||||
|
||||
git__free(iter->name);
|
||||
git__free(iter->regexp);
|
||||
git__free(iter);
|
||||
|
Loading…
Reference in New Issue
Block a user