[test] Freeing memory during unittests
authorYongjoo Ahn <yongjoo1.ahn@samsung.com>
Wed, 14 Feb 2024 08:51:23 +0000 (17:51 +0900)
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>
Mon, 19 Feb 2024 04:54:48 +0000 (13:54 +0900)
- Unref memory properly used in unittests.

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
tests/nnstreamer_filter_single/unittest_filter_single.cc
tests/nnstreamer_plugins/unittest_plugins.cc

index 9db0de7..b92a3b4 100644 (file)
@@ -172,6 +172,7 @@ TEST_F (NNSFilterSingleTest, setInvalidInfo_n)
   in_info.info[0].type = _NNS_UINT8;
   gst_tensor_parse_dimension ("3:224:224:1", in_info.info[0].dimension);
   EXPECT_TRUE (klass->set_input_info (single, &in_info, &out_info) == 0);
+  gst_tensors_info_free (&out_info);
 
   /* request to set invalid tensor info */
   gst_tensor_parse_dimension ("1:1:1:1", in_info.info[0].dimension);
@@ -317,6 +318,7 @@ TEST_F (NNSFilterSingleTestExtended, setInvalidInfo_n)
   in_info.info[1].type = _NNS_FLOAT32;
   gst_tensor_parse_dimension ("4:4:4:4:4", in_info.info[1].dimension);
   EXPECT_TRUE (klass->set_input_info (single, &in_info, &out_info) == 0);
+  gst_tensors_info_free (&out_info);
 
   /* request to set invalid tensor info */
   in_info.num_tensors = 1U;
index 6498e51..5eb6289 100644 (file)
@@ -3232,6 +3232,8 @@ TEST (testTensorConverter, bytesToMultiInvalidType03_n)
   EXPECT_DEATH (gst_harness_push (h, in_buf), "");
 
   EXPECT_EQ (gst_harness_buffers_received (h), 0U);
+
+  gst_buffer_unref (in_buf);
   gst_harness_teardown (h);
 }
 
@@ -3272,6 +3274,8 @@ TEST (testTensorConverter, bytesToMultiInvalidSize_n)
   EXPECT_DEATH (gst_harness_push (h, in_buf), "");
 
   EXPECT_EQ (gst_harness_buffers_received (h), 0U);
+
+  gst_buffer_unref (in_buf);
   gst_harness_teardown (h);
 }