From 4c92db9ee5c34fc39fc016a639b6b0c9402ffa36 Mon Sep 17 00:00:00 2001 From: hj kim Date: Wed, 26 Dec 2018 11:20:24 +0900 Subject: [PATCH] Coverity issue fix Change-Id: Iaa52a7b7ad1a67f9f04489d35803fa370acc6986 --- src/image_util.c | 5 ++++- src/image_util_encode.c | 8 ++++++-- test/image_util_test.c | 4 +++- 3 files changed, 13 insertions(+), 4 deletions(-) mode change 100644 => 100755 src/image_util.c diff --git a/src/image_util.c b/src/image_util.c old mode 100644 new mode 100755 index 30fb64d..3d5d15a --- a/src/image_util.c +++ b/src/image_util.c @@ -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"); diff --git a/src/image_util_encode.c b/src/image_util_encode.c index 306ea0e..eacf97c 100755 --- a/src/image_util_encode.c +++ b/src/image_util_encode.c @@ -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; diff --git a/test/image_util_test.c b/test/image_util_test.c index d75077e..da2439f 100755 --- a/test/image_util_test.c +++ b/test/image_util_test.c @@ -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); -- 2.7.4