# HG changeset patch # User Mike Becker # Date 1744915709 -7200 # Node ID 5dfce68057ce608a745471d7b6e553be0d1b155e # Parent 0597f1f20ea9385eb2783974aa57f4e513b0d911 fix theoretical (but not actual) use-after-free diff -r 0597f1f20ea9 -r 5dfce68057ce tests/test_mempool.c --- a/tests/test_mempool.c Thu Apr 17 20:47:43 2025 +0200 +++ b/tests/test_mempool.c Thu Apr 17 20:48:29 2025 +0200 @@ -199,6 +199,10 @@ cxMempoolFree(src); CX_TEST_ASSERT(test_mempool_destructor_called == 0); + // cover illegal arguments + result = cxMempoolTransfer(dest, dest); + CX_TEST_ASSERT(result != 0); + // verify that destroying new pool calls the destructors // but only three times (the old allocator has a different destructor) cxMempoolFree(dest); @@ -206,10 +210,6 @@ // free the foreign object free(c); - - // cover illegal arguments - result = cxMempoolTransfer(dest, dest); - CX_TEST_ASSERT(result != 0); } }