From: Mikko Rasa Date: Wed, 19 Jun 2013 13:28:38 +0000 (+0300) Subject: Fix some issues with BlockAllocator::release_blocks_end X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=8d13f6fea658c3c69cf235953c9a2f23de6a8814;p=r2c2.git Fix some issues with BlockAllocator::release_blocks_end --- 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--);