diff options
| author | Carlos MartÃn Nieto <cmn@dwim.me> | 2016-03-29 14:47:31 +0200 |
|---|---|---|
| committer | Edward Thomson <ethomson@github.com> | 2016-03-31 10:41:33 -0400 |
| commit | f5c874a475f746bb1357710c417fa902dd662eaf (patch) | |
| tree | 814d5f706d74a5270094adbf9ccd600cfc3d38e6 /src/iterator.c | |
| parent | 1694a63994e58ea0f479cfab318d99c7cb9bbeba (diff) | |
| download | libgit2-f5c874a475f746bb1357710c417fa902dd662eaf.tar.gz | |
Plug a few leaks
Diffstat (limited to 'src/iterator.c')
| -rw-r--r-- | src/iterator.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/iterator.c b/src/iterator.c index 4202e00cd..6566f43f2 100644 --- a/src/iterator.c +++ b/src/iterator.c @@ -667,6 +667,7 @@ done: static void tree_iterator_frame_pop(tree_iterator *iter) { tree_iterator_frame *frame; + git_buf *buf = NULL; assert(iter->frames.size); @@ -674,6 +675,14 @@ static void tree_iterator_frame_pop(tree_iterator *iter) git_vector_free(&frame->entries); git_tree_free(frame->tree); + + do { + buf = git_array_pop(frame->similar_paths); + git_buf_free(buf); + } while (buf != NULL); + + git_array_clear(frame->similar_paths); + git_buf_free(&frame->path); } static int tree_iterator_current( @@ -1760,6 +1769,10 @@ static int filesystem_iterator_reset(git_iterator *i) static void filesystem_iterator_free(git_iterator *i) { filesystem_iterator *iter = (filesystem_iterator *)i; + git__free(iter->root); + git_buf_free(&iter->current_path); + if (iter->index) + git_index_snapshot_release(&iter->index_snapshot, iter->index); filesystem_iterator_clear(iter); } @@ -1823,6 +1836,7 @@ static int iterator_for_filesystem( (error = git_index_snapshot_new(&iter->index_snapshot, index)) < 0) goto on_error; + iter->index = index; iter->dirload_flags = (iterator__ignore_case(&iter->base) ? GIT_PATH_DIR_IGNORE_CASE : 0) | (iterator__flag(&iter->base, PRECOMPOSE_UNICODE) ? |
