Coverity issue fix 95/196195/2 accepted/tizen/unified/20181227.062031 submit/tizen/20181226.064859
authorhj kim <backto.kim@samsung.com>
Wed, 26 Dec 2018 02:20:24 +0000 (11:20 +0900)
committerhj kim <backto.kim@samsung.com>
Wed, 26 Dec 2018 05:21:52 +0000 (14:21 +0900)
Change-Id: Iaa52a7b7ad1a67f9f04489d35803fa370acc6986

src/image_util.c [changed mode: 0644->0755]
src/image_util_encode.c
test/image_util_test.c

old mode 100644 (file)
new mode 100755 (executable)
index 30fb64d..3d5d15a
@@ -367,7 +367,10 @@ gpointer __mm_util_thread_repeate(gpointer data)
 
                ret = __mm_util_transform(handle);
 
-               image_util_debug("result_image: %p [%zu] %lu X %lu (%u)", handle->dst->data, handle->dst->size, handle->dst->width, handle->dst->height, handle->dst->color);
+               if (handle->dst != NULL)
+                       image_util_debug("result_image: %p [%zu] %lu X %lu (%u)", handle->dst->data, handle->dst->size, handle->dst->width, handle->dst->height, handle->dst->color);
+               else
+                       image_util_error("Error - handle->dst is NULL");
 
                if (ret == IMAGE_UTIL_ERROR_NONE)
                        image_util_debug("Success - transform");
index 306ea0e..eacf97c 100755 (executable)
@@ -70,7 +70,7 @@ static void __free_source_buffer(encode_s *handle)
        image_util_fleave();
 }
 
-int image_util_encode_create(image_util_type_e image_type, image_util_encode_h * handle)
+int image_util_encode_create(image_util_type_e image_type, image_util_encode_h *handle)
 {
        int err = IMAGE_UTIL_ERROR_NONE;
 
@@ -101,7 +101,11 @@ int image_util_encode_create(image_util_type_e image_type, image_util_encode_h *
                __allocate_source_buffer(_handle);
 
                err = mm_util_gif_encode_create(&_handle->gif_encode_info.image_h);
-               image_util_retvm_if((err != MM_UTIL_ERROR_NONE),  _image_error_capi(err), "Error - mm_util_gif_encode_create is failed (%d)", err);
+               if (err != MM_UTIL_ERROR_NONE) {
+                       image_util_error("Error - mm_util_gif_encode_create is failed (%d)", err);
+                       image_util_encode_destroy(_handle);
+                       return _image_error_capi(err);
+               }
        }
 
        *handle = (image_util_encode_h) _handle;
index d75077e..da2439f 100755 (executable)
@@ -167,8 +167,10 @@ bool test_transform_completed_cb(media_packet_h *packet, image_util_error_e erro
 
                FILE *fpout = fopen(output_file, "w");
                if (fpout) {
-                       media_packet_get_buffer_size(*packet, &size);
                        void *dst = NULL;
+                       if(media_packet_get_buffer_size(*packet, &size) != MEDIA_PACKET_ERROR_NONE)
+                               g_printf("Fail to media_packet_get_buffer_size \n");
+
                        if (media_packet_get_buffer_data_ptr(*packet, &dst) != MEDIA_PACKET_ERROR_NONE) {
                                IMAGE_UTIL_SAFE_FREE(dst);
                                IMAGE_UTIL_SAFE_FREE(output_fmt);