From 0c29baf3b93a05276efcc08f93582d4e8c5e6178 Mon Sep 17 00:00:00 2001 From: Jongkyu Koo Date: Wed, 8 Feb 2017 14:49:20 +0900 Subject: [PATCH] fix memory leak Change-Id: I4f0f493dc1eb6b181e9104c98bde671e925f15df Signed-off-by: Jongkyu Koo (cherry picked from commit 92417e5c17b26a98db68116bf5e4a7242187bd27) --- common/ipc/ctsvc_ipc_marshal.c | 2 ++ server/db/ctsvc_db_query.c | 5 +++++ test/test_query.c | 2 ++ 3 files changed, 9 insertions(+) diff --git a/common/ipc/ctsvc_ipc_marshal.c b/common/ipc/ctsvc_ipc_marshal.c index fda5259..7dafe3e 100644 --- a/common/ipc/ctsvc_ipc_marshal.c +++ b/common/ipc/ctsvc_ipc_marshal.c @@ -648,6 +648,8 @@ int ctsvc_ipc_unmarshal_record_common(const pims_ipc_data_h ipc_data, ctsvc_reco tmp = pims_ipc_data_get(ipc_data, &size); if (NULL == tmp) { ERR("pims_ipc_data_get() Fail"); + free(common->properties_flags); + common->properties_flags = NULL; return CONTACTS_ERROR_NO_DATA; } common->property_flag = *(unsigned char*)tmp; diff --git a/server/db/ctsvc_db_query.c b/server/db/ctsvc_db_query.c index 6de0029..10a3bd0 100644 --- a/server/db/ctsvc_db_query.c +++ b/server/db/ctsvc_db_query.c @@ -4104,6 +4104,7 @@ static int __ctsvc_db_get_contact_changes(const char *view_uri, int addressbook_ if (CONTACTS_ERROR_NONE != ret) { /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); + contacts_list_destroy(list, true); return ret; /* LCOV_EXCL_STOP */ } @@ -4180,6 +4181,7 @@ static int __ctsvc_db_get_group_changes(const char *view_uri, int addressbook_id if (CONTACTS_ERROR_NONE != ret) { /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); + contacts_list_destroy(list, true); return ret; /* LCOV_EXCL_STOP */ } @@ -4253,6 +4255,7 @@ static int __ctsvc_db_get_group_relations_changes(const char *view_uri, if (CONTACTS_ERROR_NONE != ret) { /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); + contacts_list_destroy(list, true); return ret; /* LCOV_EXCL_STOP */ } @@ -4313,6 +4316,7 @@ static int __ctsvc_db_get_group_member_changes(const char *view_uri, int address if (CONTACTS_ERROR_NONE != ret) { /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); + contacts_list_destroy(list, true); return ret; /* LCOV_EXCL_STOP */ } @@ -4390,6 +4394,7 @@ static int __ctsvc_db_get_my_profile_changes(const char *view_uri, int addressbo if (CONTACTS_ERROR_NONE != ret) { /* LCOV_EXCL_START */ ERR("ctsvc_query_get_first_int_result() Fail(%d)", ret); + contacts_list_destroy(list, true); return ret; /* LCOV_EXCL_STOP */ } diff --git a/test/test_query.c b/test/test_query.c index 44dcda3..c7815f5 100644 --- a/test/test_query.c +++ b/test/test_query.c @@ -214,6 +214,8 @@ static void _get_query_on_uri(const char *uri, int limit, int offset, contacts_q CONTACTS_MATCH_GREATER_THAN, 0); } else { ERR("Invalid uri[%s]", uri); + contacts_filter_destroy(filter); + contacts_query_destroy(query); return; } -- 2.7.4