diff options
author | Yunjin Lee <yunjin-.lee@samsung.com> | 2020-03-10 10:56:52 +0900 |
---|---|---|
committer | Yunjin Lee <yunjin-.lee@samsung.com> | 2020-03-11 15:04:49 +0900 |
commit | 4a4f9bb33902ab1e3de1507af3d322f0fbb8de07 (patch) | |
tree | 34ce4ed6e548c35de2fd561de4175d4dbd38b3b3 | |
parent | 935ea47811bbd2f78538c92afbcfd1c978054cb9 (diff) | |
download | askuser-popup-4a4f9bb33902ab1e3de1507af3d322f0fbb8de07.tar.gz askuser-popup-4a4f9bb33902ab1e3de1507af3d322f0fbb8de07.tar.bz2 askuser-popup-4a4f9bb33902ab1e3de1507af3d322f0fbb8de07.zip |
Fix memory leaksubmit/tizen/20200316.044509
Change-Id: I81d5f3c4739d426537964363d2c09a3b6e9b6d11
Signed-off-by: Yunjin Lee <yunjin-.lee@samsung.com>
-rw-r--r-- | ui/src/popup.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/ui/src/popup.c b/ui/src/popup.c index b3efb54..6de9195 100644 --- a/ui/src/popup.c +++ b/ui/src/popup.c @@ -128,7 +128,17 @@ static char* __get_popup_contents(const char* pkgid, const char* privacy, __attribute__((unused)) bool is_accessible) { LOGD("__get_message(%s, %s)", pkgid, privacy); - char* message = __make_message(MSG_POPUP_TEXT, __get_pkg_label(pkgid), __get_privacy_display(privacy)); + char* pkg_label = __get_pkg_label(pkgid); + char* privacy_display = __get_privacy_display(privacy); + char* message = __make_message(MSG_POPUP_TEXT, pkg_label, privacy_display); + + LOGD("pkg_label strlen = %d", strlen(pkg_label)); + + if (strlen(pkg_label) > 0) + free(pkg_label); + if (strlen(privacy_display) > 0) + free(privacy_display); + if (idx == -1) return message; @@ -136,8 +146,11 @@ static char* __get_popup_contents(const char* pkgid, const char* privacy, int ret = 0; if (is_accessible) { + char* ao_counter = __get_accessible_counter(idx, num); ret = asprintf(&counter_message, "%s%s%s%s", - message, AO_LABEL_PADDING, AO_LABEL_PADDING, __get_accessible_counter(idx, num)); + message, AO_LABEL_PADDING, AO_LABEL_PADDING, ao_counter); + if (strlen(ao_counter) > 0) + free(ao_counter); } else { ret = asprintf(&counter_message, "%s%s%s%d / %d", message, LABEL_PADDING, LABEL_PADDING, idx, num); |