diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2013-08-08 21:00:33 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2013-08-08 21:00:33 +0200 |
commit | a319ffaead9290bfe35a0f105ff17dacaf7b6e7f (patch) | |
tree | 9e4ec931c3c32db006dbe121ce1819dfb0c6f67f | |
parent | 1e96c9d5341e5f2b0e1af9a1088cc30d3ffb9a01 (diff) | |
download | libgit2-a319ffaead9290bfe35a0f105ff17dacaf7b6e7f.tar.gz |
config: fix leaks in the iterators
-rw-r--r-- | src/config.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c index 83b101ded..42273cde8 100644 --- a/src/config.c +++ b/src/config.c @@ -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); |