Thu, 17 Apr 2025 20:48:29 +0200
fix theoretical (but not actual) use-after-free
tests/test_mempool.c | file | annotate | diff | comparison | revisions |
--- 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); } }