From 8d13f6fea658c3c69cf235953c9a2f23de6a8814 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 19 Jun 2013 16:28:38 +0300 Subject: [PATCH] Fix some issues with BlockAllocator::release_blocks_end --- source/libr2c2/blockallocator.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/libr2c2/blockallocator.cpp b/source/libr2c2/blockallocator.cpp index 7dcc15b..429e19f 100644 --- a/source/libr2c2/blockallocator.cpp +++ b/source/libr2c2/blockallocator.cpp @@ -267,10 +267,13 @@ void BlockAllocator::release_blocks_end(const BlockList::iterator &begin) if(begin==blocks.begin()) return release_blocks_begin(blocks.end()); + if(begin==blocks.end()) + return; + /* Release the blocks in reverse order so that a consistent state is presented in block_reserved signal. */ bool done = false; - for(BlockList::iterator i=blocks.end(); !done; ) + for(BlockList::iterator i=--blocks.end(); !done; ) { done = (i==begin); release_block(i--); -- 2.43.0