[evolution/gnome-3-36] ECompEditorPageSchedule: Fix some minor issues reported by Coverity Scan
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-36] ECompEditorPageSchedule: Fix some minor issues reported by Coverity Scan
- Date: Fri, 15 May 2020 14:18:39 +0000 (UTC)
commit 1bbc741ae8f6904fdad057b7b45a649a54f1f253
Author: Milan Crha <mcrha redhat com>
Date: Fri May 15 16:16:40 2020 +0200
ECompEditorPageSchedule: Fix some minor issues reported by Coverity Scan
The claim was about not checking return value of e_date_edit_get_date().
When being in it, added check for the e_date_edit_get_time_of_day()
value as well and noticed the comp_editor is not unreffed in error
branches, thus covered also possible memory leak.
src/calendar/gui/e-comp-editor-page-schedule.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/src/calendar/gui/e-comp-editor-page-schedule.c b/src/calendar/gui/e-comp-editor-page-schedule.c
index 10c728c4b7..36d7bb8384 100644
--- a/src/calendar/gui/e-comp-editor-page-schedule.c
+++ b/src/calendar/gui/e-comp-editor-page-schedule.c
@@ -220,18 +220,31 @@ ecep_schedule_set_time_to_editor (ECompEditorPageSchedule *page_schedule)
end_tt = e_comp_editor_property_part_datetime_get_value (dtend);
if (!start_tt || !end_tt) {
+ g_clear_object (&comp_editor);
+ g_clear_object (&start_tt);
+ g_clear_object (&end_tt);
+ return;
+ }
+
+ if (!e_date_edit_get_date (E_DATE_EDIT (selector->start_date_edit), &year, &month, &day) ||
+ !e_date_edit_get_time_of_day (E_DATE_EDIT (selector->start_date_edit), &hour, &minute)) {
+ g_clear_object (&comp_editor);
g_clear_object (&start_tt);
g_clear_object (&end_tt);
return;
}
- e_date_edit_get_date (E_DATE_EDIT (selector->start_date_edit), &year, &month, &day);
- e_date_edit_get_time_of_day (E_DATE_EDIT (selector->start_date_edit), &hour, &minute);
i_cal_time_set_date (start_tt, year, month, day);
i_cal_time_set_time (start_tt, hour, minute, 0);
- e_date_edit_get_date (E_DATE_EDIT (selector->end_date_edit), &year, &month, &day);
- e_date_edit_get_time_of_day (E_DATE_EDIT (selector->end_date_edit), &hour, &minute);
+ if (!e_date_edit_get_date (E_DATE_EDIT (selector->end_date_edit), &year, &month, &day) ||
+ !e_date_edit_get_time_of_day (E_DATE_EDIT (selector->end_date_edit), &hour, &minute)) {
+ g_clear_object (&comp_editor);
+ g_clear_object (&start_tt);
+ g_clear_object (&end_tt);
+ return;
+ }
+
i_cal_time_set_date (end_tt, year, month, day);
i_cal_time_set_time (end_tt, hour, minute, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]