From d050a57e4ccf06bfbda8978adf26fdb00d51211e Mon Sep 17 00:00:00 2001 From: Jiwoong Im Date: Wed, 8 Feb 2017 21:47:06 +0900 Subject: [PATCH] Fix memory leak issue Change-Id: I15671f30e12eb93e5fc39188139d4ae5e56aa575 Signed-off-by: Jiwoong Im --- lib/buxton2.c | 4 ++-- migration/vconf_migration.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/buxton2.c b/lib/buxton2.c index 486c310..58dba14 100644 --- a/lib/buxton2.c +++ b/lib/buxton2.c @@ -2064,9 +2064,9 @@ static struct bxt_req *security_control(struct buxton_client *client, req = create_req(layer, NULL, callback, NULL, user_data); + layer_unref(layer); if (!req) return NULL; - layer_unref(layer); memset(&rqst, 0, sizeof(rqst)); rqst.type = MSG_CTRL; @@ -2213,9 +2213,9 @@ static struct bxt_req *update_client_label(struct buxton_client *client, req = create_req(layer, NULL, callback, NULL, user_data); + layer_unref(layer); if (!req) return NULL; - layer_unref(layer); memset(&rqst, 0, sizeof(rqst)); rqst.type = MSG_CTRL; diff --git a/migration/vconf_migration.c b/migration/vconf_migration.c index 070fba2..3632a78 100644 --- a/migration/vconf_migration.c +++ b/migration/vconf_migration.c @@ -159,12 +159,14 @@ static int _load_vconf_dir(const char *directory) struct dirent file_info; struct dirent *result; char buf[BUF_LEN]; - keylist_t *keylist = vconf_keylist_new(); + keylist_t *keylist; dir = opendir(directory); if (!dir) return -1; + keylist = vconf_keylist_new(); + while (readdir_r(dir, &file_info, &result) == 0) { if (result == NULL) break; -- 2.7.4