From: Abhishek Vijay Date: Fri, 27 Apr 2018 13:29:52 +0000 (+0530) Subject: [Non-ACR][Critical Coverity Fixes] X-Git-Tag: accepted/tizen/unified/20180511.172146~3 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fpim%2Fcontacts-service.git;a=commitdiff_plain;h=0ff4010ac2c2c6c1eb440f7a5fb95728832abccd [Non-ACR][Critical Coverity Fixes] Change-Id: I559794f01498a14dcf5721bce071f4ec4f41b4b5 Signed-off-by: Abhishek Vijay --- diff --git a/common/ctsvc_vcard.c b/common/ctsvc_vcard.c index 93cc7cb..0a7faa8 100644 --- a/common/ctsvc_vcard.c +++ b/common/ctsvc_vcard.c @@ -3907,15 +3907,17 @@ static inline int __ctsvc_vcard_get_contact(int ver, char *vcard, contacts_recor new_start = __ctsvc_vcard_get_val(ver, cursor, &prefix, &val); if (NULL == new_start) { - free(prefix); - free(val); + if (prefix) + free(prefix); + if (val) + free(val); continue; } if (NULL == val) { cursor = new_start; - free(prefix); - free(val); + if (prefix) + free(prefix); continue; } diff --git a/server/ctsvc_ipc_server.c b/server/ctsvc_ipc_server.c index dec01c2..39ea717 100644 --- a/server/ctsvc_ipc_server.c +++ b/server/ctsvc_ipc_server.c @@ -2093,6 +2093,10 @@ DATA_FREE: contacts_list_destroy(list, true); free(view_uri); free(keyword); + if (start_match) + free(start_match); + if (end_match) + free(end_match); ctsvc_server_start_timeout(); return; } @@ -2257,6 +2261,10 @@ DATA_FREE: contacts_list_destroy(list, true); free(view_uri); free(keyword); + if (start_match) + free(start_match); + if (end_match) + free(end_match); ctsvc_server_start_timeout(); return; } @@ -2412,6 +2420,10 @@ DATA_FREE: contacts_list_destroy(list, true); contacts_query_destroy(query); free(keyword); + if (start_match) + free(start_match); + if (end_match) + free(end_match); ctsvc_server_start_timeout(); return; } diff --git a/server/ctsvc_server_bg.c b/server/ctsvc_server_bg.c index c569a58..5aca342 100644 --- a/server/ctsvc_server_bg.c +++ b/server/ctsvc_server_bg.c @@ -133,7 +133,11 @@ static int __ctsvc_server_bg_contact_delete_step2(__ctsvc_delete_data_s *data) } ret = ctsvc_begin_trans(); - RETVM_IF(CONTACTS_ERROR_NONE != ret, CONTACTS_ERROR_DB, "DB Fail"); + if (ret != CONTACTS_ERROR_NONE) { + g_slist_free(list); + ERR("DB Fail"); + return CONTACTS_ERROR_DB; + } cursor = g_slist_nth(list, 0); while (cursor) { @@ -191,7 +195,11 @@ static int __ctsvc_server_bg_contact_delete_step3(__ctsvc_delete_data_s *data) } ret = ctsvc_begin_trans(); - RETVM_IF(CONTACTS_ERROR_NONE != ret, CONTACTS_ERROR_DB, "DB Fail"); + if (ret != CONTACTS_ERROR_NONE) { + g_slist_free(list); + ERR("DB Fail"); + return CONTACTS_ERROR_DB; + } cursor = g_slist_nth(list, 0); while (cursor) {