Fixed memory leak of testsuites 38/114438/1 accepted/tizen/3.0/common/20170214.180833 accepted/tizen/3.0/ivi/20170214.092322 accepted/tizen/3.0/mobile/20170214.092202 accepted/tizen/3.0/tv/20170214.092240 accepted/tizen/3.0/wearable/20170214.092315 submit/tizen_3.0/20170214.014640
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>
Mon, 13 Feb 2017 09:50:57 +0000 (01:50 -0800)
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 bac4c4f..e19efbe 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 d6ef9de..b2a5f19 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 4b54e91..e7fbbf7 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 6bf6fa2..24721d4 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):",