Fix Coverity issue 57/174057/2 accepted/tizen/unified/20180330.060544 submit/tizen/20180328.012050
authorhj kim <backto.kim@samsung.com>
Wed, 28 Mar 2018 00:55:37 +0000 (09:55 +0900)
committerhj kim <backto.kim@samsung.com>
Wed, 28 Mar 2018 00:56:54 +0000 (09:56 +0900)
Change-Id: I533b84614f37d7c5f12094fb3fcfb90046f0e2bb

packaging/capi-media-image-util.spec
src/image_util.c

index 1331f7a..c2ffffd 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-image-util
 Summary:    A Image Utility library in Tizen Native API
-Version:    0.1.38
+Version:    0.1.39
 Release:    2
 Group:      Multimedia/API
 License:    Apache-2.0
index 69cd731..9e79528 100755 (executable)
@@ -277,7 +277,7 @@ int image_util_transform_create(transformation_h * handle)
 {
        int err = MM_UTIL_ERROR_NONE;
 
-       image_util_debug("image_util_create");
+       image_util_fenter();
 
        image_util_retvm_if((handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
 
@@ -498,7 +498,7 @@ int image_util_transform_run(transformation_h handle, media_packet_h src, image_
        int err = MM_UTIL_ERROR_NONE;
        transformation_s *_handle = (transformation_s *) handle;
 
-       image_util_debug("image_util_transform");
+       image_util_fenter();
 
        image_util_retvm_if((_handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
        image_util_retvm_if((completed_cb == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid callback");
@@ -534,12 +534,9 @@ int image_util_transform_destroy(transformation_h handle)
        int err = MM_UTIL_ERROR_NONE;
        transformation_s *_handle = (transformation_s *) handle;
 
-       image_util_debug("image_util_destroy");
+       image_util_fenter();
 
-       if (_handle == NULL) {
-               image_util_error("Invalid Handle");
-               return IMAGE_UTIL_ERROR_INVALID_PARAMETER;
-       }
+       image_util_retvm_if((_handle == NULL), IMAGE_UTIL_ERROR_INVALID_PARAMETER, "Invalid Handle");
 
        err = mm_util_destroy(_handle->image_h);
 
@@ -576,7 +573,13 @@ int image_util_extract_color_from_memory(const unsigned char *image_buffer, int
        module = g_module_open(PATH_MMUTIL_IMGCV_LIB, G_MODULE_BIND_LAZY);
        image_util_retvm_if((module == NULL), IMAGE_UTIL_ERROR_NO_SUCH_FILE, "fail to open module");
 
-       g_module_symbol(module, IMGCV_FUNC_NAME, (gpointer *)&mmutil_imgcv_module_func);
+       if (!g_module_symbol(module, IMGCV_FUNC_NAME, (gpointer *)&mmutil_imgcv_module_func)) {
+               image_util_error("fail to g_module_symbol");
+               g_module_close(module);
+
+               return IMAGE_UTIL_ERROR_INVALID_OPERATION;
+       }
+
        if (!mmutil_imgcv_module_func)
                g_module_close(module);