Dynamic memory referenced by 'pref_str' was allocated at preference.c:1245
by calling function 'preference_get_string' at config.cpp:74 and lost at config.cpp:75.
Change-Id: I5f7a6f24701a8e4730daeb24903f78fafd3c142f
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
int ret;
ret = preference_get_string(key, &pref_str);
- if (ret == PREFERENCE_ERROR_NONE && pref_str) {
- value.assign(pref_str, strlen(pref_str));
+ if (pref_str) {
+ if (ret == PREFERENCE_ERROR_NONE)
+ value.assign(pref_str, strlen(pref_str));
+
free(pref_str);
}
}