mv_machine_learning: fix coverity issue 82/282082/3
authorInki Dae <inki.dae@samsung.com>
Tue, 27 Sep 2022 02:19:02 +0000 (11:19 +0900)
committersangho park <sangho.g.park@samsung.com>
Tue, 27 Sep 2022 03:40:45 +0000 (12:40 +0900)
[Version] : 0.23.26-0
[Issue type] : bug fix

Fixed a coverity issue by handling an error value correctly.

Change-Id: Icce85a27e2be29f38799a4f312d40978d60e59eb
Signed-off-by: Inki Dae <inki.dae@samsung.com>
mv_machine_learning/inference/src/Inference.cpp
packaging/capi-media-vision.spec

index 9f3b25c..18f6544 100644 (file)
@@ -810,7 +810,11 @@ int Inference::Preprocess(std::vector<mv_source_h> &mv_sources, std::vector<cv::
                Options opt;
                mv_colorspace_e colorspace = MEDIA_VISION_COLORSPACE_INVALID;
 
-               mv_source_get_colorspace(mv_sources[src_idx], &colorspace);
+               int ret = mv_source_get_colorspace(mv_sources[src_idx], &colorspace);
+               if (ret != MEDIA_VISION_ERROR_NONE) {
+                       LOGE("Fail to get color space.");
+                       return ret;
+               }
 
                if (mMetadata.GetInputMeta().IsParsed()) {
                        layerInfo = mMetadata.GetInputMeta().GetLayer().at(buffer.first);
@@ -840,7 +844,7 @@ int Inference::Preprocess(std::vector<mv_source_h> &mv_sources, std::vector<cv::
                }
 
                // TODO: try-catch{} error handling
-               int ret = mPreProc.Run(cv_sources[src_idx++], colorspace, data_type, layerInfo, opt, tensor_buffer.buffer);
+               ret = mPreProc.Run(cv_sources[src_idx++], colorspace, data_type, layerInfo, opt, tensor_buffer.buffer);
                if (ret != MEDIA_VISION_ERROR_NONE) {
                        LOGE("Fail to run pre-process.");
                        return ret;
index 36761cc..3e53cfe 100644 (file)
@@ -1,6 +1,6 @@
 Name:        capi-media-vision
 Summary:     Media Vision library for Tizen Native API
-Version:     0.23.25
+Version:     0.23.26
 Release:     0
 Group:       Multimedia/Framework
 License:     Apache-2.0 and BSD-3-Clause