Commit 687db88faf8bcfe7bccfedf65fa304f59987089c

Russell Belfer 2013-04-22T16:45:36

Make sure diff output is cleared on error

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/src/diff.c b/src/diff.c
index bce2914..881173c 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 */