]> git.mdlowis.com Git - projs/libcds.git/commitdiff
Fix memory leak in tests for buf
authorMichael D. Lowis <mike@mdlowis.com>
Wed, 30 Jul 2014 01:49:02 +0000 (21:49 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Wed, 30 Jul 2014 01:49:02 +0000 (21:49 -0400)
tests/test_buf.c

index 4e0fdad3ae07ea96b4dd3c82e3bc382646e0a7ee..0dab2716c8d42a7a1edd44927ad1121cbe9170eb 100644 (file)
@@ -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);
     }
 }