[evolution/gnome-3-36] Calendar: Correct management of ECalComponentDateTime structures



commit 09dcf3325679d175c72bf10d79e05ae4215040ce
Author: Milan Crha <mcrha redhat com>
Date:   Tue Apr 14 14:25:44 2020 +0200

    Calendar: Correct management of ECalComponentDateTime structures
    
    Covers two memory leaks and one use of an incorrect free function.

 src/calendar/gui/comp-util.c  | 2 ++
 src/calendar/gui/e-day-view.c | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/calendar/gui/comp-util.c b/src/calendar/gui/comp-util.c
index 1816c13d51..4fb3dc3092 100644
--- a/src/calendar/gui/comp-util.c
+++ b/src/calendar/gui/comp-util.c
@@ -424,6 +424,8 @@ cal_comp_event_new_with_current_time_sync (ECalClient *client,
                e_cal_component_set_dtend (comp, dt);
        }
 
+       e_cal_component_datetime_free (dt);
+
        return comp;
 }
 
diff --git a/src/calendar/gui/e-day-view.c b/src/calendar/gui/e-day-view.c
index 1fd1dd9890..543a163262 100644
--- a/src/calendar/gui/e-day-view.c
+++ b/src/calendar/gui/e-day-view.c
@@ -5657,8 +5657,8 @@ e_day_view_finish_resize (EDayView *day_view)
                (only_new_attendees ? E_CAL_OPS_SEND_FLAG_ONLY_NEW_ATTENDEES : 0));
 
  out:
+       e_cal_component_datetime_free (date);
        g_object_unref (comp);
-       g_clear_object (&date);
 }
 
 static void
@@ -9322,6 +9322,7 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
                                        zone ? g_strdup (i_cal_timezone_get_tzid (zone)) : NULL);
                        }
                        cal_comp_set_dtend_with_oldzone (client, comp, date);
+                       e_cal_component_datetime_free (date);
 
                        gtk_drag_finish (context, TRUE, TRUE, time);
 


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