projects
/
platform
/
core
/
accessibility
/
universal-switch.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3edad4e
)
fix for resource leak
36/212436/3
author
Radoslaw Cybulski
<r.cybulski@partner.samsung.com>
Wed, 21 Aug 2019 10:54:10 +0000
(12:54 +0200)
committer
Lukasz Oleksak
<l.oleksak@samsung.com>
Wed, 21 Aug 2019 12:52:07 +0000
(12:52 +0000)
Fix for memory leak, where memory allocated by vconf_get_str
would not be released.
Change-Id: Ia1370e457bbaf6c8fc71ce0d81debf922c9a86dd
src/VConf.cpp
patch
|
blob
|
history
diff --git
a/src/VConf.cpp
b/src/VConf.cpp
index 0af9ad41349e8a0abb8a726b10c36532c781680b..b0492570a42af42fa6e41b84f01e217f341ff49d 100644
(file)
--- a/
src/VConf.cpp
+++ b/
src/VConf.cpp
@@
-187,8
+187,11
@@
public:
{
auto k = keyPrefix + key;
char *str = vconf_get_str(k.c_str());
- if (str)
- return str;
+ if (str) {
+ auto s = std::string{ str };
+ free(str);
+ return std::move(s);
+ }
INFO("Vconf: cant get value for key: %s, returning default value = %s", k.c_str(), value.c_str());
return value;