Commit 3f3d21badda4dbd9c8c8536ba7e34805a3cadd50

Vicent Marti 2014-06-11T18:56:24

Merge pull request #2417 from libgit2/cmn/revwalk-array-fix revwalk: more sensible array handling

diff --git a/src/revwalk.c b/src/revwalk.c
index 7aedd1f..530c970 100644
--- a/src/revwalk.c
+++ b/src/revwalk.c
@@ -48,7 +48,7 @@ static int mark_uninteresting(git_revwalk *walk, git_commit_list_node *commit)
 
 	assert(commit);
 
-	git_array_alloc(pending);
+	git_array_init_to_size(pending, 2);
 	GITERR_CHECK_ARRAY(pending);
 
 	do {
@@ -67,7 +67,7 @@ static int mark_uninteresting(git_revwalk *walk, git_commit_list_node *commit)
 		tmp = git_array_pop(pending);
 		commit = tmp ? *tmp : NULL;
 
-	} while (git_array_size(pending) > 0);
+	} while (commit != NULL);
 
 	git_array_clear(pending);