From: Michael D. Lowis Date: Wed, 30 Jul 2014 01:49:02 +0000 (-0400) Subject: Fix memory leak in tests for buf X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=74f5e1554f66a95f8738262909dff9ef2e204a51;p=projs%2Flibcds.git Fix memory leak in tests for buf --- diff --git a/tests/test_buf.c b/tests/test_buf.c index 4e0fdad..0dab271 100644 --- a/tests/test_buf.c +++ b/tests/test_buf.c @@ -129,15 +129,17 @@ TEST_SUITE(Buffer) { TEST(Verify_buf_write_should_return_0_if_buffer_is_full) { buf_t* buf = buf_new(1); + void* box = mem_box(0x1234); CHECK( true == buf_write(buf, mem_box(0x1234))); - CHECK( false == buf_write(buf, mem_box(0x1234))); + CHECK( false == buf_write(buf, box)); + mem_release(box); mem_release(buf); } TEST(Verify_buf_write_should_return_1_if_data_successfully_wrote) { buf_t* buf = buf_new(1); - CHECK( true == buf_write(buf, mem_box(0x1234))); + CHECK( true == buf_write(buf, mem_box(0x1234))); mem_release(buf); } }