fix memory leak 14/113614/2
authorJongkyu Koo <jk.koo@samsung.com>
Wed, 8 Feb 2017 05:49:20 +0000 (14:49 +0900)
committerJongkyu Koo <jk.koo@samsung.com>
Wed, 8 Feb 2017 07:51:09 +0000 (23:51 -0800)
Change-Id: I4f0f493dc1eb6b181e9104c98bde671e925f15df
Signed-off-by: Jongkyu Koo <jk.koo@samsung.com>
(cherry picked from commit 92417e5c17b26a98db68116bf5e4a7242187bd27)

common/ipc/ctsvc_ipc_marshal.c
server/db/ctsvc_db_query.c
test/test_query.c

index fda5259..7dafe3e 100644 (file)
@@ -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;
index 6de0029..10a3bd0 100644 (file)
@@ -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 */
        }
index 44dcda3..c7815f5 100644 (file)
@@ -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;
        }