summaryrefslogtreecommitdiff
path: root/src/iterator.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlosmn@github.com>2016-02-18 12:28:06 +0100
committerCarlos Martín Nieto <carlosmn@github.com>2016-02-18 12:28:06 +0100
commit594a5d12d4b9ba3ea542722805ada1028bd1b646 (patch)
tree80ad162215ad18b05a29e6ca8d476ad987f15b02 /src/iterator.c
parent298d1b07af7450041ce78a0a377f207b993b5693 (diff)
parent318b825e76a9dc8afefc8274c5271747ad64d5a9 (diff)
downloadlibgit2-594a5d12d4b9ba3ea542722805ada1028bd1b646.tar.gz
Merge pull request #3619 from ethomson/win32_forbidden
win32: allow us to read indexes with forbidden paths on win32
Diffstat (limited to 'src/iterator.c')
-rw-r--r--src/iterator.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/iterator.c b/src/iterator.c
index 04aac3e01..024a97573 100644
--- a/src/iterator.c
+++ b/src/iterator.c
@@ -558,6 +558,8 @@ static bool tree_iterator__pop_frame(tree_iterator *ti, bool final)
{
tree_iterator_frame *tf = ti->head;
+ assert(tf);
+
if (!tf->up)
return false;
@@ -581,6 +583,8 @@ static void tree_iterator__pop_all(tree_iterator *ti, bool to_end, bool final)
while (tree_iterator__pop_frame(ti, final)) /* pop to root */;
if (!final) {
+ assert(ti->head);
+
ti->head->current = to_end ? ti->head->n_entries : 0;
ti->path_ambiguities = 0;
git_buf_clear(&ti->path);
@@ -773,10 +777,12 @@ static void tree_iterator__free(git_iterator *self)
{
tree_iterator *ti = (tree_iterator *)self;
- tree_iterator__pop_all(ti, true, false);
+ if (ti->head) {
+ tree_iterator__pop_all(ti, true, false);
+ git_tree_free(ti->head->entries[0]->tree);
+ git__free(ti->head);
+ }
- git_tree_free(ti->head->entries[0]->tree);
- git__free(ti->head);
git_pool_clear(&ti->pool);
git_buf_free(&ti->path);
}