fix prevent issue
authorChangseok Oh <seok.oh@samsung.com>
Wed, 30 Oct 2013 02:57:30 +0000 (11:57 +0900)
committerChangseok Oh <seok.oh@samsung.com>
Wed, 30 Oct 2013 02:57:30 +0000 (11:57 +0900)
utils/MsgContact.cpp

index b4ce3fe..b614b7f 100755 (executable)
@@ -227,6 +227,8 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
                ret = contacts_list_get_current_record_p(contacts, &number);
                if (ret != CONTACTS_ERROR_NONE) {
                        MSG_DEBUG("contacts_list_get_current_record_p() Error [%d]", ret);
+                       contacts_query_destroy(query);
+                       contacts_filter_destroy(filter);
                        contacts_list_destroy(contacts, true);
                        return MSG_SUCCESS;
                }
@@ -234,6 +236,8 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
                ret = contacts_record_get_int(number, _contacts_contact_number.contact_id, &index);
                if (ret != CONTACTS_ERROR_NONE) {
                        MSG_DEBUG("contacts_record_get_int() Error [%d]", ret);
+                       contacts_query_destroy(query);
+                       contacts_filter_destroy(filter);
                        contacts_list_destroy(contacts, true);
                        contacts_record_destroy(number, true);
                        return MSG_SUCCESS;
@@ -242,6 +246,8 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
                ret = contacts_db_get_record(_contacts_contact._uri, index, &contact);
                if (ret != CONTACTS_ERROR_NONE) {
                        MSG_DEBUG("contacts_db_get_record() Error [%d]", ret);
+                       contacts_query_destroy(query);
+                       contacts_filter_destroy(filter);
                        contacts_list_destroy(contacts, true);
                        contacts_record_destroy(contact, true);
                        contacts_record_destroy(number, true);
@@ -253,6 +259,8 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
                ret = contacts_list_get_current_record_p(contacts, &email);
                if (ret != CONTACTS_ERROR_NONE) {
                        MSG_DEBUG("contacts_list_get_current_record_p() Error [%d]", ret);
+                       contacts_query_destroy(query);
+                       contacts_filter_destroy(filter);
                        contacts_list_destroy(contacts, true);
                        return MSG_SUCCESS;
                }
@@ -260,6 +268,8 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
                ret = contacts_record_get_int(email, _contacts_contact_email.contact_id, &index);
                if (ret != CONTACTS_ERROR_NONE) {
                        MSG_DEBUG("contacts_record_get_int() Error [%d]", ret);
+                       contacts_query_destroy(query);
+                       contacts_filter_destroy(filter);
                        contacts_list_destroy(contacts, true);
                        contacts_record_destroy(email, true);
                        return MSG_SUCCESS;
@@ -268,6 +278,8 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
                ret = contacts_db_get_record(_contacts_contact._uri, index, &contact);
                if (ret != CONTACTS_ERROR_NONE) {
                        MSG_DEBUG("contacts_db_get_record() Error [%d]", ret);
+                       contacts_query_destroy(query);
+                       contacts_filter_destroy(filter);
                        contacts_list_destroy(contacts, true);
                        contacts_record_destroy(contact, true);
                        contacts_record_destroy(email, true);
@@ -275,6 +287,8 @@ msg_error_t MsgGetContactInfo(const MSG_ADDRESS_INFO_S *pAddrInfo, MSG_CONTACT_I
                }
        }
 
+       contacts_query_destroy(query);
+       contacts_filter_destroy(filter);
        contacts_list_destroy(contacts, true);
 
        // Name Info
@@ -366,6 +380,7 @@ void MsgSyncContact()
 
        if (ret != CONTACTS_ERROR_NONE) {
                MSG_DEBUG("contacts_db_get_changes_by_version() Error [%d]", ret);
+               contacts_list_destroy(contactsList, true);
                return;
        }