[evolution-data-server] libecal: Fix a warning caught by a gcc static analyzer



commit 76aeea1b26d4af43fc18f3f3b5a3fa462241e699
Author: Milan Crha <mcrha redhat com>
Date:   Thu Apr 15 14:25:28 2021 +0200

    libecal: Fix a warning caught by a gcc static analyzer
    
    src/calendar/libecal/e-cal-component.c:0: scope_hint: In function 'e_cal_component_has_simple_recurrence'
    src/calendar/libecal/e-cal-component.c:3064:12: warning[-Wanalyzer-null-dereference]: dereference of NULL 
'rrule_list'
      3062|
      3063|         /* Down to one rule, so test that one */
      3064|->       rt = rrule_list->data;
      3065|
      3066|         /* Any funky frequency? */

 src/calendar/libecal/e-cal-component.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/calendar/libecal/e-cal-component.c b/src/calendar/libecal/e-cal-component.c
index c8c1ed10b..89824d84c 100644
--- a/src/calendar/libecal/e-cal-component.c
+++ b/src/calendar/libecal/e-cal-component.c
@@ -3055,9 +3055,9 @@ e_cal_component_has_simple_recurrence (ECalComponent *comp)
 
        rrule_list = e_cal_component_get_rrules (comp);
        len = g_slist_length (rrule_list);
-       if (len > 1
-           || e_cal_component_has_rdates (comp)
-           || e_cal_component_has_exrules (comp))
+       if (len > 1 || !rrule_list ||
+           e_cal_component_has_rdates (comp) ||
+           e_cal_component_has_exrules (comp))
                goto cleanup;
 
        /* Down to one rule, so test that one */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]