diff options
Diffstat (limited to 'src/iterator.c')
-rw-r--r-- | src/iterator.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/iterator.c b/src/iterator.c index 369a079bc..8646399ab 100644 --- a/src/iterator.c +++ b/src/iterator.c @@ -991,8 +991,9 @@ static int fs_iterator__expand_dir(fs_iterator *fi) fi->base.start, fi->base.end, &ff->entries); if (error < 0) { - git_buf msg = GIT_BUF_INIT; - git_error_t errt = giterr_detach(&msg); + git_error last_error = {0}; + + giterr_detach(&last_error); /* these callbacks may clear the error message */ fs_iterator__free_frame(ff); @@ -1000,9 +1001,9 @@ static int fs_iterator__expand_dir(fs_iterator *fi) /* next time return value we skipped to */ fi->base.flags &= ~GIT_ITERATOR_FIRST_ACCESS; - if (msg.ptr) { - giterr_set_str(errt, msg.ptr); - git_buf_free(&msg); + if (last_error.message) { + giterr_set_str(last_error.klass, last_error.message); + free(last_error.message); } return error; |