]> git.tdb.fi Git - r2c2.git/commitdiff
Fix some issues with BlockAllocator::release_blocks_end
authorMikko Rasa <tdb@tdb.fi>
Wed, 19 Jun 2013 13:28:38 +0000 (16:28 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 19 Jun 2013 13:28:38 +0000 (16:28 +0300)
source/libr2c2/blockallocator.cpp

index 7dcc15b57acdf268ab6dc92ecf5bad2f91570158..429e19f31db95a3e4f827cc049079ad162ca6803 100644 (file)
@@ -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--);