From 1082a08793639727f3aecc3bb3e731d49f4041b7 Mon Sep 17 00:00:00 2001 From: Tae-Young Chung Date: Thu, 16 Jun 2016 11:02:56 +0900 Subject: [PATCH] [Fixed Bug] Fixed delete[] to free() [cause] In mv_engine_config_set_string_attribute(), new[] operator had been changed to malloc() Thus, the parts calling mv_engine_config_get_string_attribute should have to use free() instead of delete[] operator. [solve] The parts using mv_engine_config_get_string_attribute() is changed to deallocate memory by free() Change-Id: I60ef4823e43229214c31d0706e53d3aa51c8d600 Signed-off-by: Tae-Young Chung --- .../src/mv_barcode_generate_open.cpp | 20 ++++++++++---------- mv_face/face/src/mv_face_open.cpp | 3 ++- .../src/EventTriggerPersonRecognition.cpp | 12 ++++++++---- packaging/capi-media-vision.spec | 2 +- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/mv_barcode/barcode_generator/src/mv_barcode_generate_open.cpp b/mv_barcode/barcode_generator/src/mv_barcode_generate_open.cpp index 498cbf9..ddf552e 100644 --- a/mv_barcode/barcode_generator/src/mv_barcode_generate_open.cpp +++ b/mv_barcode/barcode_generator/src/mv_barcode_generate_open.cpp @@ -241,7 +241,7 @@ int mv_barcode_generate_source_open( error = mv_engine_config_get_string_attribute(engine_cfg, "MV_BARCODE_GENERATE_ATTR_COLOR_FRONT", &fgcolour); if (error != MEDIA_VISION_ERROR_NONE) { if (fgcolour) { - delete [] fgcolour; + free(fgcolour); fgcolour = NULL; } @@ -252,12 +252,12 @@ int mv_barcode_generate_source_open( error = mv_engine_config_get_string_attribute(engine_cfg, "MV_BARCODE_GENERATE_ATTR_COLOR_BACK", &bgcolour); if (error != MEDIA_VISION_ERROR_NONE) { if (bgcolour) { - delete [] bgcolour; + free(bgcolour); bgcolour = NULL; } if (fgcolour) { - delete [] fgcolour; + free(fgcolour); fgcolour = NULL; } @@ -301,12 +301,12 @@ int mv_barcode_generate_source_open( bgcolour); if (fgcolour != NULL) { - delete [] fgcolour; + free(fgcolour); fgcolour = NULL; } if (bgcolour != NULL) { - delete [] bgcolour; + free(bgcolour); bgcolour = NULL; } @@ -403,7 +403,7 @@ int mv_barcode_generate_image_open( error = mv_engine_config_get_string_attribute(engine_cfg, "MV_BARCODE_GENERATE_ATTR_COLOR_FRONT", &fgcolour); if (error != MEDIA_VISION_ERROR_NONE) { if (fgcolour) { - delete [] fgcolour; + free(fgcolour); fgcolour = NULL; } @@ -414,12 +414,12 @@ int mv_barcode_generate_image_open( error = mv_engine_config_get_string_attribute(engine_cfg, "MV_BARCODE_GENERATE_ATTR_COLOR_BACK", &bgcolour); if (error != MEDIA_VISION_ERROR_NONE) { if (bgcolour) { - delete [] bgcolour; + free(bgcolour); bgcolour = NULL; } if (fgcolour) { - delete [] fgcolour; + free(fgcolour); fgcolour = NULL; } @@ -464,12 +464,12 @@ int mv_barcode_generate_image_open( bgcolour); if (fgcolour != NULL) { - delete [] fgcolour; + free(fgcolour); fgcolour = NULL; } if (bgcolour != NULL) { - delete [] bgcolour; + free(bgcolour); bgcolour = NULL; } diff --git a/mv_face/face/src/mv_face_open.cpp b/mv_face/face/src/mv_face_open.cpp index 07e07df..f1a70ec 100644 --- a/mv_face/face/src/mv_face_open.cpp +++ b/mv_face/face/src/mv_face_open.cpp @@ -100,7 +100,8 @@ int mv_face_detect_open( LOGI("Haarcascade file was set as default"); haarcascadeFilePathStr = std::string(haarcascadeFilepath); - delete[] haarcascadeFilepath; + free(haarcascadeFilepath); + haarcascadeFilepath = NULL; } else { LOGE("Error occurred during face detection haarcascade file receiving." " (%i)", error); diff --git a/mv_surveillance/surveillance/src/EventTriggerPersonRecognition.cpp b/mv_surveillance/surveillance/src/EventTriggerPersonRecognition.cpp index c5dd126..f99c78a 100644 --- a/mv_surveillance/surveillance/src/EventTriggerPersonRecognition.cpp +++ b/mv_surveillance/surveillance/src/EventTriggerPersonRecognition.cpp @@ -174,14 +174,18 @@ int EventTriggerPersonRecognition::parseEngineConfig(mv_engine_config_h engineCo LOGE("Failed to load face recognition model. Check %s attribute of the " "engine config.", MV_SURVEILLANCE_FACE_RECOGNITION_MODEL_FILE_PATH); - if (modelPath != NULL) - delete[] modelPath; + if (modelPath != NULL) { + free(modelPath); + modelPath = NULL; + } return MEDIA_VISION_ERROR_INVALID_PARAMETER; } - if (modelPath != NULL) - delete[] modelPath; + if (modelPath != NULL) { + free(modelPath); + modelPath = NULL; + } return MEDIA_VISION_ERROR_NONE; } diff --git a/packaging/capi-media-vision.spec b/packaging/capi-media-vision.spec index 12729c8..cd8360a 100644 --- a/packaging/capi-media-vision.spec +++ b/packaging/capi-media-vision.spec @@ -1,6 +1,6 @@ Name: capi-media-vision Summary: Media Vision library for Tizen Native API -Version: 0.3.18 +Version: 0.3.19 Release: 0 Group: Multimedia/Framework License: Apache-2.0 and BSD-2.0 -- 2.7.4