[Non-ACR][Critical Coverity Fixes] 90/177390/1
authorAbhishek Vijay <abhishek.v@samsung.com>
Fri, 27 Apr 2018 13:29:52 +0000 (18:59 +0530)
committerAbhishek Vijay <abhishek.v@samsung.com>
Fri, 27 Apr 2018 13:29:52 +0000 (18:59 +0530)
Change-Id: I559794f01498a14dcf5721bce071f4ec4f41b4b5
Signed-off-by: Abhishek Vijay <abhishek.v@samsung.com>
common/ctsvc_vcard.c
server/ctsvc_ipc_server.c
server/ctsvc_server_bg.c

index 93cc7cb..0a7faa8 100644 (file)
@@ -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;
                }
 
index dec01c2..39ea717 100644 (file)
@@ -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;
 }
index c569a58..5aca342 100644 (file)
@@ -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) {