Fix resource leaks 29/213029/5 accepted/tizen_5.5_unified accepted/tizen_5.5_unified_mobile_hotfix accepted/tizen_5.5_unified_wearable_hotfix accepted/tizen_6.0_unified accepted/tizen_6.0_unified_hotfix tizen_5.5 tizen_5.5_mobile_hotfix tizen_5.5_tv tizen_5.5_wearable_hotfix tizen_6.0 tizen_6.0_hotfix accepted/tizen/5.5/unified/20191031.022121 accepted/tizen/5.5/unified/mobile/hotfix/20201027.090022 accepted/tizen/5.5/unified/wearable/hotfix/20201027.112704 accepted/tizen/6.0/unified/20201030.115232 accepted/tizen/6.0/unified/hotfix/20201103.003132 accepted/tizen/unified/20190903.110908 accepted/tizen/unified/20191211.235828 submit/tizen/20190903.063348 submit/tizen/20191211.064057 submit/tizen_5.5/20191031.000004 submit/tizen_5.5_mobile_hotfix/20201026.185104 submit/tizen_5.5_wearable_hotfix/20201026.184304 submit/tizen_6.0/20201029.205104 submit/tizen_6.0_hotfix/20201102.192504 submit/tizen_6.0_hotfix/20201103.114804 tizen_5.5.m2_release tizen_6.0.m2_release
authors414.kim <s414.kim@samsung.com>
Thu, 29 Aug 2019 09:32:10 +0000 (18:32 +0900)
committerSangwan Kwon <sangwan.kwon@samsung.com>
Mon, 2 Sep 2019 05:03:59 +0000 (14:03 +0900)
Change-Id: I9b15df8b4f5873416eb6ec362ad56e60a74c7ed9
Signed-off-by: s414.kim <s414.kim@samsung.com>
Signed-off-by: Sangwan Kwon <sangwan.kwon@samsung.com>
ode/src/interface/tools/vconf.cpp
ode/src/interface/tools/vconf.h
secure-erase/src/ui.c

index 2c1fe3bca14e0c0ceca46be9145a1d27c50113af..05af81e4c0bea00efa21d3a6f5b0539ba15077b4 100644 (file)
@@ -18,6 +18,8 @@
 
 #include "vconf.h"
 
+#include <cstdlib>
+
 static void keyChangedCallback(keynode_t *node, void *data)
 {
        Vconf *vconf = reinterpret_cast<Vconf *>(data);
@@ -33,9 +35,12 @@ Vconf::~Vconf()
 {
 }
 
-char *Vconf::getString()
+std::string Vconf::getString()
 {
-       return ::vconf_get_str(vconfKey.c_str());
+       char *tmp = ::vconf_get_str(vconfKey.c_str());
+       std::string ret = (tmp != nullptr) ? std::string(tmp) : std::string();
+       ::free(tmp);
+       return ret;
 }
 
 int Vconf::getInt()
index 680fcea12a3b3cc0697c2fa3fb5c526e181476ba..0e3b6140ff447862a9bacb9c6590edc739cad3c9 100644 (file)
@@ -19,6 +19,8 @@
 #ifndef __ODE_VCONF_H__
 #define __ODE_VCONF_H__
 
+#include <string>
+
 #include <vconf.h>
 #include "../../widgets/signal.h"
 
@@ -27,7 +29,7 @@ public:
        Vconf(const std::string &key);
        ~Vconf();
 
-       char *getString();
+       std::string getString();
        int getInt();
        bool getBool();
 
index 6cf2fa3327b60ddf66f11010bebd6293751d1c8b..f18b4057ec96df4a7b9b3274e41b8c616a56ba49 100644 (file)
@@ -109,6 +109,7 @@ static Eina_Bool progressbar_timer_cb(void *data)
        progress = vconf_get_str(VCONFKEY_ODE_ERASE_PROGRESS);
        if (progress) {
                percentage = atoi(progress);
+               free(progress);
        } else {
                delete_notification(ud->notification);
                ui_app_exit();