[evolution-data-server] e-cal-component: Fix a logic flaw in the foreach_property()



commit 3e85021a8e3ddb8871f4cd8f08955654a6b60e85
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jun 8 18:57:00 2022 +0200

    e-cal-component: Fix a logic flaw in the foreach_property()
    
    This could leak the `prop` variable, but none of the current callbacks
    return FALSE, thus the fix is for any future only.

 src/calendar/libecal/e-cal-component.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/calendar/libecal/e-cal-component.c b/src/calendar/libecal/e-cal-component.c
index 90a7eee5a..6d74c80e9 100644
--- a/src/calendar/libecal/e-cal-component.c
+++ b/src/calendar/libecal/e-cal-component.c
@@ -128,8 +128,10 @@ foreach_property (ICalComponent *icalcomp,
        for (prop = i_cal_component_get_first_property (icalcomp, prop_kind);
             prop;
             g_object_unref (prop), prop = i_cal_component_get_next_property (icalcomp, prop_kind)) {
-               if (!func (icalcomp, prop, user_data))
+               if (!func (icalcomp, prop, user_data)) {
+                       g_object_unref (prop);
                        break;
+               }
        }
 }
 


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