Skip to content

Commit 5cd74de

Browse files
author
David R. MacIver
committed
it's important to use unsortedCount rather than unsorted.length as flush() may be called when the unsorted array is not full due to its use in reserve. This could result in freed IDs leaking into the list twice
1 parent 36caffb commit 5cd74de

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/com/rabbitmq/utility/IntAllocator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ private void flush(){
140140
ListIterator<Interval> it = intervals.listIterator();
141141

142142
int i = 0;
143-
while(i < unsorted.length){
143+
while(i < unsortedCount){
144144
int start = i;
145-
while((i < unsorted.length - 1) && (unsorted[i + 1] == unsorted[i] + 1))
145+
while((i < unsortedCount - 1) && (unsorted[i + 1] == unsorted[i] + 1))
146146
i++;
147147

148148
Interval interval = new Interval(start, i);

0 commit comments

Comments
 (0)