First all elements of a block are allocated. Then one additional element is allocated, which starts a new block. But then memory is written after the end of the first block, which is out of bounds and causes a crash. --- This fixes a crashing kdevelop test. personally i can not see how this could ever have worked. Anything else we should check instead in this test? OK to commit? languages/cpp/parser/tests/test_pool.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/languages/cpp/parser/tests/test_pool.cpp b/languages/cpp/parser/tests/test_pool.cpp index 9113221..ba6e5c0 100644 --- a/languages/cpp/parser/tests/test_pool.cpp +++ b/languages/cpp/parser/tests/test_pool.cpp @@ -60,10 +60,10 @@ void TestPool::testNewBlockAllocation() int lastOne = alloc._S_block_size / sizeof(int) - 1; p[lastOne] = 10; //the first one in another block - alloc.allocate(1); - p[lastOne+1] = 11; + int *p2 = alloc.allocate(1); + p2[0] = 11; QCOMPARE(p[lastOne], 10); - QCOMPARE(p[lastOne+1], 11); + QCOMPARE(p2[0], 11); } void TestPool::testWastedMemoryDueToBlockAllocation() -- 1.6.2.3