Fixed memory leak of testsuites 18/114218/2 accepted/tizen/common/20170214.173632 accepted/tizen/ivi/20170214.230010 accepted/tizen/mobile/20170214.225923 accepted/tizen/tv/20170214.225939 accepted/tizen/unified/20170309.031440 accepted/tizen/wearable/20170214.225957 submit/tizen/20170214.014812 submit/tizen_unified/20170308.100404
authorTae-Young Chung <ty83.chung@samsung.com>
Fri, 10 Feb 2017 11:48:42 +0000 (20:48 +0900)
committerTae-Young Chung <ty83.chung@samsung.com>
Fri, 10 Feb 2017 11:50:55 +0000 (20:50 +0900)
Change-Id: Ic9f660c8acb5bbd622f34011982dc06ceba72448
Signed-off-by: Tae-Young Chung <ty83.chung@samsung.com>
packaging/capi-media-vision.spec
test/testsuites/barcode/barcode_test_suite.c
test/testsuites/image/image_test_suite.c
test/testsuites/surveillance/surveillance_test_suite.c

index bac4c4f34f3ad571b8f1ad5400d0a626b74f9942..e19efbe0642e1962ef705ccf1453b49afed393f9 100644 (file)
@@ -1,7 +1,7 @@
 Name:        capi-media-vision
 Summary:     Media Vision library for Tizen Native API
 Version:     0.3.24
-Release:     1
+Release:     2
 Group:       Multimedia/Framework
 License:     Apache-2.0 and BSD-2.0
 Source0:     %{name}-%{version}.tar.gz
index d6ef9de38e027a083485e08cf551d89451a40e0b..b2a5f19f115f4fc8aed19124f233227fb0b0f138 100644 (file)
@@ -666,6 +666,9 @@ int detect_barcode(barcode_model_s model, mv_rectangle_s roi)
        if (MEDIA_VISION_ERROR_NONE != err) {
                printf("ERROR: Errors were occurred during opening the file!!! code: %i\n", err);
 
+               if (data_buffer != NULL)
+                       destroy_loaded_buffer(data_buffer);
+
                MEDIA_VISION_FUNCTION_LEAVE();
 
                return err;
@@ -677,6 +680,12 @@ int detect_barcode(barcode_model_s model, mv_rectangle_s roi)
        if (MEDIA_VISION_ERROR_NONE != err) {
                printf("ERROR: Can't convert to the selected colorspace!!! code: %i\n", err);
 
+               if (data_buffer != NULL)
+                       destroy_loaded_buffer(data_buffer);
+
+               if (converted_buffer)
+                       free(converted_buffer);
+
                MEDIA_VISION_FUNCTION_LEAVE();
 
                return err;
@@ -684,7 +693,7 @@ int detect_barcode(barcode_model_s model, mv_rectangle_s roi)
 
        model.out_buffer_ptr = data_buffer;
 
-       mv_engine_config_h mv_engine_config;
+       mv_engine_config_h mv_engine_config = NULL;
        err = mv_create_engine_config(&mv_engine_config);
        if (MEDIA_VISION_ERROR_NONE != err)
                printf("ERROR: Errors were occurred during creating the media engine config: %i\n", err);
@@ -705,6 +714,15 @@ int detect_barcode(barcode_model_s model, mv_rectangle_s roi)
        if (MEDIA_VISION_ERROR_NONE != err) {
                printf("ERROR: Errors were occurred during creating the source!!! code: %i\n", err);
 
+               if (data_buffer != NULL)
+                       destroy_loaded_buffer(data_buffer);
+
+               if (converted_buffer)
+                       free(converted_buffer);
+
+               if (mv_engine_config)
+                       mv_destroy_engine_config(mv_engine_config);
+
                MEDIA_VISION_FUNCTION_LEAVE();
 
                return err;
@@ -715,6 +733,16 @@ int detect_barcode(barcode_model_s model, mv_rectangle_s roi)
        if (MEDIA_VISION_ERROR_NONE != err) {
                printf("ERROR: Errors were occurred during filling the source!!! code: %i\n", err);
 
+               if (data_buffer != NULL)
+                       destroy_loaded_buffer(data_buffer);
+
+               if (converted_buffer)
+                       free(converted_buffer);
+
+               if (mv_engine_config)
+                       mv_destroy_engine_config(mv_engine_config);
+
+               mv_destroy_source(source);
                MEDIA_VISION_FUNCTION_LEAVE();
 
                return err;
@@ -728,14 +756,9 @@ int detect_barcode(barcode_model_s model, mv_rectangle_s roi)
        if (data_buffer != NULL)
                destroy_loaded_buffer(data_buffer);
 
-       if (MEDIA_VISION_ERROR_NONE != err) {
+       if (MEDIA_VISION_ERROR_NONE != err)
                printf("ERROR: Errors were occurred during barcode detection!!! code: %i\n", err);
 
-               MEDIA_VISION_FUNCTION_LEAVE();
-
-               return err;
-       }
-
        err = mv_destroy_source(source);
        if (MEDIA_VISION_ERROR_NONE != err)
                printf("ERROR: Errors were occurred during destroying the source!!! code: %i\n", err);
index 4b54e9134683dbd16ddb1188ea9aa38e58ad523b..e7fbbf799e1bb55c4a2596ab75dc9738ba8e1e65 100644 (file)
@@ -471,6 +471,7 @@ int recognize_image(const char *path_to_image,
                        printf("\nERROR: Errors were occurred during source destroying;"
                                        "code %i\n", err2);
                }
+               destroy_recognition_result(&result);
                MEDIA_VISION_FUNCTION_LEAVE();
                return err;
        }
index 6bf6fa2e6ac84c710ed9b058c7a78bd72446612d..24721d4f220975c278fdd2a0748e28fa9cef14b7 100644 (file)
@@ -567,14 +567,15 @@ void push_source()
                PRINT_R("Incorrect input! Try again.");
 
        error = load_mv_source_from_file(path_to_image, source);
+
+       if (path_to_image != NULL)
+               free(path_to_image);
+
        if (MEDIA_VISION_ERROR_NONE != error) {
                PRINT_E("Errors were occurred during source loading, code %i", error);
                return;
        }
 
-       if (path_to_image != NULL)
-               free(path_to_image);
-
        int video_stream_id = 0;
 
        while (input_int("Input video stream identificator (integer value):",