Fix possible memory leak in unittest 23/255923/3
authorJihoon Kim <jihoon48.kim@samsung.com>
Thu, 25 Mar 2021 04:56:08 +0000 (13:56 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 25 Mar 2021 05:53:35 +0000 (14:53 +0900)
Change-Id: I0fee6f5bd53ee58f9f5b4785d958bffedfec86bc
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
tests/src/sticker_data_unittests.cc

index 31b44685d6754858fe79d2e8463ac4fd30e7d674..5557f292ef755a8c9cbdc25ebcc2d0d05f989c9a 100644 (file)
@@ -544,6 +544,9 @@ TEST_F(StickerDataTest, tc_sticker_data_get_handle_n)
 {
     sticker_data_h tmp_handle = NULL;
     int ret = sticker_data_get_handle("", &tmp_handle);
+    if (tmp_handle)
+        sticker_data_destroy(tmp_handle);
+
     EXPECT_EQ(ret, STICKER_ERROR_INVALID_PARAMETER);
 }
 
@@ -556,6 +559,9 @@ TEST_F(StickerDataTest, utc_sticker_data_get_handle_n2)
 {
     sticker_data_h tmp_handle = NULL;
     int ret = sticker_data_get_handle("www.invalid.com", &tmp_handle);
+    if (tmp_handle)
+        sticker_data_destroy(tmp_handle);
+
     EXPECT_EQ(ret, STICKER_ERROR_NO_SUCH_FILE);
 }