[UTC][capi-media-image-util][Non-ACR][Fix a problem where TC sometimes fails] 46/241146/3
authorjiyong.min <jiyong.min@samsung.com>
Tue, 18 Aug 2020 04:30:54 +0000 (13:30 +0900)
committerJihun Park <jihun87.park@samsung.com>
Wed, 19 Aug 2020 06:25:45 +0000 (06:25 +0000)
  - Checked the other result value for encoding.
    g_encode_result[type].size -> g_encode_result[type].buffer_size

  - Add clear initialization for size and buffer_size.

Change-Id: Ie4e57208f401ecde5852d28662eb8ad1c5aa19b7

src/utc/image-util/utc-image-util-decode-encode.c

index c4e740825d8de900ba3d2b0e47c9cf2793b92895..464a53a108c97ce8780b0ffa58b6e6b9ef98a930 100755 (executable)
@@ -268,7 +268,10 @@ void utc_image_util_decode_cleanup(void)
 
        for (type = 0; type <= LAST_IMAGE_TYPE; type++) {
                IMAGEUTIL_SAFE_G_FREE(g_decode_result[type].buffer);
+               g_decode_result[type].size = 0;
                IMAGEUTIL_SAFE_G_FREE(g_encode_result[type].buffer);
+               g_encode_result[type].size = 0;
+               g_encode_result[type].buffer_size = 0;
                IMAGEUTIL_SAFE_G_FREE(g_source_path[type]);
                IMAGEUTIL_SAFE_G_FREE(g_output_path[type]);
                image_util_decode_destroy(g_decoder[type]);
@@ -1644,7 +1647,10 @@ void utc_image_util_encode_cleanup(void)
        
        for (type = 0; type <= LAST_IMAGE_TYPE; type++) {
                IMAGEUTIL_SAFE_FREE(g_decode_result[type].buffer);
+               g_decode_result[type].size = 0;
                IMAGEUTIL_SAFE_FREE(g_encode_result[type].buffer);
+               g_encode_result[type].size = 0;
+               g_encode_result[type].buffer_size = 0;
                IMAGEUTIL_SAFE_G_FREE (g_source_path[type]);
                IMAGEUTIL_SAFE_G_FREE (g_output_path[type]);
                image_util_encode_destroy(g_encoder[type]);
@@ -3145,7 +3151,7 @@ int utc_image_util_encode_run_async_to_buffer_p(void)
                wait_for_async();
                assert_eq(callback_error, IMAGE_UTIL_ERROR_NONE);
                assert_neq(g_encode_result[type].buffer, NULL);
-               assert_gt(g_encode_result[type].size, 0);
+               assert_gt(g_encode_result[type].buffer_size, 0);
        }
 
        return 0;