From: Abhishek Vijay Date: Tue, 1 May 2018 12:15:52 +0000 (+0530) Subject: [Non-ACR][Major Coverity Fixes] X-Git-Tag: accepted/tizen/unified/20180504.081305^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d91d4cad58c9655664de265591c85a8f0c81c610;p=platform%2Fcore%2Fpim%2Fcalendar-service.git [Non-ACR][Major Coverity Fixes] Change-Id: Icd56e528b8f1bf208b582ab518bfbd27ecd6b2d4 Signed-off-by: Abhishek Vijay --- diff --git a/common/cal_vcalendar_make.c b/common/cal_vcalendar_make.c index 632ba88..aad8264 100644 --- a/common/cal_vcalendar_make.c +++ b/common/cal_vcalendar_make.c @@ -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; diff --git a/server/db/cal_db_plugin_book.c b/server/db/cal_db_plugin_book.c index 041ad85..10e252f 100644 --- a/server/db/cal_db_plugin_book.c +++ b/server/db/cal_db_plugin_book.c @@ -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); } diff --git a/server/db/cal_db_plugin_event.c b/server/db/cal_db_plugin_event.c index ab3e987..940ca95 100644 --- a/server/db/cal_db_plugin_event.c +++ b/server/db/cal_db_plugin_event.c @@ -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); diff --git a/server/db/cal_db_plugin_instance_localtime_extended.c b/server/db/cal_db_plugin_instance_localtime_extended.c index 004e37e..0486da3 100644 --- a/server/db/cal_db_plugin_instance_localtime_extended.c +++ b/server/db/cal_db_plugin_instance_localtime_extended.c @@ -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); } diff --git a/server/db/cal_db_plugin_instance_utime_extended.c b/server/db/cal_db_plugin_instance_utime_extended.c index fa49f72..7c8c95f 100644 --- a/server/db/cal_db_plugin_instance_utime_extended.c +++ b/server/db/cal_db_plugin_instance_utime_extended.c @@ -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); } diff --git a/server/db/cal_db_plugin_search.c b/server/db/cal_db_plugin_search.c index 8a9f236..5bb5a3b 100644 --- a/server/db/cal_db_plugin_search.c +++ b/server/db/cal_db_plugin_search.c @@ -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); } diff --git a/server/db/cal_db_plugin_todo.c b/server/db/cal_db_plugin_todo.c index 94b76cb..0715ba2 100644 --- a/server/db/cal_db_plugin_todo.c +++ b/server/db/cal_db_plugin_todo.c @@ -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); }