Commit a319ffae by Carlos Martín Nieto

config: fix leaks in the iterators

parent 1e96c9d5
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment