summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-04-22 16:45:36 -0700
committerRussell Belfer <rb@github.com>2013-04-23 12:57:30 -0700
commit687db88faf8bcfe7bccfedf65fa304f59987089c (patch)
tree46e284f5d7fa80141a9769c2c4d49ca22937ad98
parentb1ff7004ab132c8d4bddd181127f1c8d5ce9b7b4 (diff)
downloadlibgit2-687db88faf8bcfe7bccfedf65fa304f59987089c.tar.gz
Make sure diff output is cleared on error
-rw-r--r--src/diff.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/diff.c b/src/diff.c
index bce2914d1..881173cde 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -702,7 +702,11 @@ int git_diff__from_iterators(
int error = 0;
const git_index_entry *oitem, *nitem;
git_buf ignore_prefix = GIT_BUF_INIT;
- git_diff_list *diff = diff_list_alloc(repo, old_iter, new_iter);
+ git_diff_list *diff;
+
+ *diff_ptr = NULL;
+
+ diff = diff_list_alloc(repo, old_iter, new_iter);
GITERR_CHECK_ALLOC(diff);
/* make iterators have matching icase behavior */