[Non-ACR][Major Coverity Fixes] 33/177533/3 accepted/tizen/unified/20180504.081305 submit/tizen/20180502.115137
authorAbhishek Vijay <abhishek.v@samsung.com>
Tue, 1 May 2018 12:15:52 +0000 (17:45 +0530)
committerAbhishek Vijay <abhishek.v@samsung.com>
Tue, 1 May 2018 12:50:35 +0000 (18:20 +0530)
Change-Id: Icd56e528b8f1bf208b582ab518bfbd27ecd6b2d4
Signed-off-by: Abhishek Vijay <abhishek.v@samsung.com>
common/cal_vcalendar_make.c
server/db/cal_db_plugin_book.c
server/db/cal_db_plugin_event.c
server/db/cal_db_plugin_instance_localtime_extended.c
server/db/cal_db_plugin_instance_utime_extended.c
server/db/cal_db_plugin_search.c
server/db/cal_db_plugin_todo.c

index 632ba88..aad8264 100644 (file)
@@ -2176,6 +2176,7 @@ int cal_vcalendar_make_vcalendar(cal_make_s *b, calendar_list_h list)
 
                char *uri = NULL;
                ret = calendar_record_get_uri_p(record, &uri);
+               if (CALENDAR_ERROR_NONE != ret) break;
 
                if (CAL_STRING_EQUAL == strcmp(uri, _calendar_extended_property._uri)) {
                        cal_extended_s *extended = (cal_extended_s *)record;
index 041ad85..10e252f 100644 (file)
@@ -539,7 +539,6 @@ static int _cal_db_book_get_records_with_query(calendar_query_h query, int offse
 
        /* bind text */
        if (bind_text) {
-               g_slist_length(bind_text);
                for (cursor = bind_text, i = 1; cursor; cursor = cursor->next, i++)
                        cal_db_util_stmt_bind_text(stmt, i, cursor->data);
        }
index ab3e987..940ca95 100644 (file)
@@ -180,7 +180,7 @@ static int _cal_db_event_get_record(int id, calendar_record_h* out_record)
        /* check */
        ret = cal_db_get_record(_calendar_book._uri, event->calendar_id, &record_calendar);
        if (CALENDAR_ERROR_NONE == ret) {
-               ret = calendar_record_get_int(record_calendar,
+               calendar_record_get_int(record_calendar,
                                _calendar_book.sync_event, (int *)&sync_event_type);
                calendar_record_destroy(record_calendar, true);
        }
@@ -2499,6 +2499,9 @@ static int _cal_db_event_exception_update(cal_list_s *exception_list_s, int orig
                                        /* update */
                                        __update_recurrence_id(exception, old_type, new_type, time_diff);
                                        ret = _cal_db_event_update_record(exception);
+                                       if (CALENDAR_ERROR_NONE != ret) {
+                                               WARN("_cal_db_event_update_record() Fail(%d)", ret);
+                                       }
                                        cal_db_instance_discard_record(exception_id);
                                        cal_db_instance_publish_record(exception);
 
index 004e37e..0486da3 100644 (file)
@@ -218,7 +218,6 @@ static int _cal_db_instance_localtime_extended_get_records_with_query(calendar_q
 
        /* bind text */
        if (bind_text) {
-               g_slist_length(bind_text);
                for (cursor = bind_text, i = 1; cursor; cursor = cursor->next, i++)
                        cal_db_util_stmt_bind_text(stmt, i, cursor->data);
        }
index fa49f72..7c8c95f 100644 (file)
@@ -217,7 +217,6 @@ static int _cal_db_instance_utime_extended_get_records_with_query(calendar_query
 
        /* bind text */
        if (bind_text) {
-               g_slist_length(bind_text);
                for (cursor = bind_text, i = 1; cursor; cursor = cursor->next, i++)
                        cal_db_util_stmt_bind_text(stmt, i, cursor->data);
        }
index 8a9f236..5bb5a3b 100644 (file)
@@ -86,10 +86,19 @@ static int _cal_db_search_get_records_with_query(calendar_query_h query, int off
        }
 
        /* make: projection */
-       if (0 < que->projection_count)
+       if (0 < que->projection_count) {
                ret = cal_db_query_create_projection(query, &projection);
-       else
-               _cal_db_search_make_projection(query, &projection);
+               if (CALENDAR_ERROR_NONE != ret) {
+                       ERR("cal_db_query_create_projection() Fail(%d)", ret);
+                       return ret;
+               }
+       } else {
+               ret = _cal_db_search_make_projection(query, &projection);
+               if (CALENDAR_ERROR_NONE != ret) {
+                       ERR("_cal_db_search_make_projection() Fail(%d)", ret);
+                       return ret;
+               }
+       }
 
        /* query - projection */
        if (CAL_STRING_EQUAL == strcmp(que->view_uri, CALENDAR_VIEW_EVENT_BOOK)) {
@@ -175,7 +184,6 @@ static int _cal_db_search_get_records_with_query(calendar_query_h query, int off
 
        /* bind text */
        if (bind_text) {
-               g_slist_length(bind_text);
                for (cursor = bind_text, i = 1; cursor; cursor = cursor->next, i++)
                        cal_db_util_stmt_bind_text(stmt, i, cursor->data);
        }
index 94b76cb..0715ba2 100644 (file)
@@ -367,6 +367,7 @@ static int _cal_db_todo_get_record(int id, calendar_record_h* out_record)
        if (CALENDAR_ERROR_NONE == ret) {
                ret = calendar_record_get_int(record_calendar,
                                _calendar_book.sync_event, (int *)&sync_event_type);
+               RETV_IF(CALENDAR_ERROR_NONE != ret, ret);
                calendar_record_destroy(record_calendar, true);
        }
        if (todo->is_deleted == 1 && sync_event_type != CALENDAR_BOOK_SYNC_EVENT_FOR_EVERY_AND_REMAIN
@@ -1084,7 +1085,6 @@ static int _cal_db_todo_get_records_with_query(calendar_query_h query, int offse
 
        /* bind text */
        if (bind_text) {
-               g_slist_length(bind_text);
                for (cursor = bind_text, i = 1; cursor; cursor = cursor->next, i++)
                        cal_db_util_stmt_bind_text(stmt, i, cursor->data);
        }