From: s414.kim Date: Thu, 29 Aug 2019 09:32:10 +0000 (+0900) Subject: Fix resource leaks X-Git-Tag: submit/tizen/20190903.063348^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Faccepted%2Ftizen_5.5_unified;p=platform%2Fcore%2Fsecurity%2Fode-ui.git Fix resource leaks Change-Id: I9b15df8b4f5873416eb6ec362ad56e60a74c7ed9 Signed-off-by: s414.kim Signed-off-by: Sangwan Kwon --- diff --git a/ode/src/interface/tools/vconf.cpp b/ode/src/interface/tools/vconf.cpp index 2c1fe3b..05af81e 100644 --- a/ode/src/interface/tools/vconf.cpp +++ b/ode/src/interface/tools/vconf.cpp @@ -18,6 +18,8 @@ #include "vconf.h" +#include + static void keyChangedCallback(keynode_t *node, void *data) { Vconf *vconf = reinterpret_cast(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() diff --git a/ode/src/interface/tools/vconf.h b/ode/src/interface/tools/vconf.h index 680fcea..0e3b614 100644 --- a/ode/src/interface/tools/vconf.h +++ b/ode/src/interface/tools/vconf.h @@ -19,6 +19,8 @@ #ifndef __ODE_VCONF_H__ #define __ODE_VCONF_H__ +#include + #include #include "../../widgets/signal.h" @@ -27,7 +29,7 @@ public: Vconf(const std::string &key); ~Vconf(); - char *getString(); + std::string getString(); int getInt(); bool getBool(); diff --git a/secure-erase/src/ui.c b/secure-erase/src/ui.c index 6cf2fa3..f18b405 100644 --- a/secure-erase/src/ui.c +++ b/secure-erase/src/ui.c @@ -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();