diff options
author | Tae-Young Chung <ty83.chung@samsung.com> | 2016-06-07 10:13:50 +0900 |
---|---|---|
committer | Tae-Young Chung <ty83.chung@samsung.com> | 2016-06-07 10:13:57 +0900 |
commit | 31817a245cf354b7bb9c7a38abd55227f3e4e463 (patch) | |
tree | 925b9b94474bd8e92fc3ee661af4e0a98c0cc977 | |
parent | c216d5649802c3eff04ab09c3a8456569df39ffc (diff) | |
download | mediavision-31817a245cf354b7bb9c7a38abd55227f3e4e463.tar.gz mediavision-31817a245cf354b7bb9c7a38abd55227f3e4e463.tar.bz2 mediavision-31817a245cf354b7bb9c7a38abd55227f3e4e463.zip |
[Fixed Bug] Fixed alloc-dealloc-mismatch (new vs. free)submit/tizen/20160609.040222accepted/tizen/wearable/20160609.091714accepted/tizen/tv/20160609.091611accepted/tizen/mobile/20160609.091959accepted/tizen/ivi/20160609.091739accepted/tizen/common/20160609.145218
[cause]
- allocate memory using operator new[]
- deallocate the memory using free()
- it may cause memory corruption or undefined behaviors
[solve]
- replace operator new[] with malloc()
Change-Id: Icc844a98fda28556b071e62ad2599bacba441974
Signed-off-by: Tae-Young Chung <ty83.chung@samsung.com>
-rw-r--r-- | mv_common/src/mv_common_c.cpp | 5 | ||||
-rw-r--r-- | packaging/capi-media-vision.spec | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/mv_common/src/mv_common_c.cpp b/mv_common/src/mv_common_c.cpp index 9242a56d..51e0dbb5 100644 --- a/mv_common/src/mv_common_c.cpp +++ b/mv_common/src/mv_common_c.cpp @@ -22,6 +22,7 @@ #include <mv_private.h> #include <string.h> +#include <stdlib.h> #include <media_packet.h> int mv_create_source_c( @@ -512,11 +513,11 @@ int mv_engine_config_get_string_attribute_c( LOGD("Convert string to char*"); int stringSize = attributeValue.size(); - (*value) = new char[stringSize + 1]; + (*value) = (char *)malloc(sizeof(char) * (stringSize + 1)); if (attributeValue.copy(*value, stringSize) != attributeValue.size()) { LOGE("Conversion from string to char* failed"); - delete[] (*value); + free(*value); (*value) = NULL; return MEDIA_VISION_ERROR_INVALID_OPERATION; } diff --git a/packaging/capi-media-vision.spec b/packaging/capi-media-vision.spec index 3f33e5e2..c9c241a7 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.16 +Version: 0.3.17 Release: 1 Group: Multimedia/Framework License: Apache-2.0 and BSD-2.0 |