summaryrefslogtreecommitdiff
path: root/src/pqueue.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2014-03-12 11:21:55 -0700
committerRussell Belfer <rb@github.com>2014-03-12 11:21:55 -0700
commit5302a88538c870028f2623b099c66c800f5cfe68 (patch)
tree473517cf5e447c8cc25e5e2430ac6d640bafb910 /src/pqueue.c
parent9af14886a94ca4d08c7af1ba84b21cba40fce34c (diff)
downloadlibgit2-5302a88538c870028f2623b099c66c800f5cfe68.tar.gz
Fix pqueue sort boundary condition bug
If the pqueue comparison fn returned just 0 or 1 (think "a<b") then the sort order of returned items could be wrong because there was a "< 0" that really needed to be "<= 0". Yikes!!!
Diffstat (limited to 'src/pqueue.c')
-rw-r--r--src/pqueue.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pqueue.c b/src/pqueue.c
index 172cf43d5..54a60ca04 100644
--- a/src/pqueue.c
+++ b/src/pqueue.c
@@ -68,7 +68,7 @@ static void pqueue_down(git_pqueue *pq, size_t el)
kid_el += 1;
}
- if (pq->_cmp(parent, kid) < 0)
+ if (pq->_cmp(parent, kid) <= 0)
break;
pq->contents[el] = kid;