[evolution-patches] Patch for a memory leak in [calendar]



Hi, 
   Have attached a patch which frees the memory before reassigning a new
value to the pointer variable in day view and week view of the calendar.

thanks, chenthill.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2570
diff -u -p -r1.2570 ChangeLog
--- ChangeLog	29 Nov 2004 09:03:43 -0000	1.2570
+++ ChangeLog	29 Nov 2004 16:11:22 -0000
@@ -1,4 +1,12 @@
 2004-11-29  Chenthill Palanisamy  <pchenthill novell com>
+
+	* gui/e-day-view.c (e_day_view_finish_resize), (e_day_view_reshape_day_event)
+       	(e_day_view_change_event_time): Free the string day_view->last_edited_comp_string
+	before changing assigning it another value.
+	* gui/e-week-view.c (e_week_view_change_event_time): Free the string
+	week_view->last_edited_comp_string for the same reason above.
+	
+2004-11-29  Chenthill Palanisamy  <pchenthill novell com>
 	* calendar-errors.xml.h: committng this file. Missed to
 	commit this one.
 
Index: gui/e-day-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-day-view.c,v
retrieving revision 1.257
diff -u -p -r1.257 e-day-view.c
--- gui/e-day-view.c	4 Nov 2004 02:03:49 -0000	1.257
+++ gui/e-day-view.c	29 Nov 2004 16:11:23 -0000
@@ -3965,6 +3965,12 @@ e_day_view_finish_resize (EDayView *day_
 	}
 
 	e_cal_component_commit_sequence (comp);
+
+	if (day_view->last_edited_comp_string != NULL) {
+		g_free (day_view->last_edited_comp_string);
+		day_view->last_edited_comp_string == NULL;
+	}
+
 	day_view->last_edited_comp_string = e_cal_component_get_as_string (comp);
 
 	gnome_canvas_item_hide (day_view->resize_rect_item);
@@ -4441,6 +4447,7 @@ e_day_view_reshape_day_events (EDayView 
 			continue;
 		if (strncmp (current_comp_string, day_view->last_edited_comp_string,50) == 0) {
 			e_canvas_item_grab_focus (event->canvas_item, TRUE);
+			g_free (day_view->last_edited_comp_string);
 			day_view-> last_edited_comp_string = NULL;
 		}
 	}
@@ -5831,6 +5838,12 @@ e_day_view_change_event_time (EDayView *
 	e_cal_component_set_dtend (comp, &date);
 
 	e_cal_component_commit_sequence (comp);
+	
+	if (day_view->last_edited_comp_string != NULL) {
+		g_free (day_view->last_edited_comp_string);
+		day_view->last_edited_comp_string = NULL;
+	}
+		
 	day_view->last_edited_comp_string = e_cal_component_get_as_string (comp);
 
 	gnome_canvas_item_hide (day_view->resize_rect_item);
Index: gui/e-week-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-week-view.c,v
retrieving revision 1.228
diff -u -p -r1.228 e-week-view.c
--- gui/e-week-view.c	4 Nov 2004 02:03:49 -0000	1.228
+++ gui/e-week-view.c	29 Nov 2004 16:11:24 -0000
@@ -3228,6 +3228,12 @@ e_week_view_change_event_time (EWeekView
 	e_cal_component_set_dtend (comp, &date);
 
 	e_cal_component_commit_sequence (comp);
+	
+	if (week_view->last_edited_comp_string != NULL) {
+		g_free (week_view->last_edited_comp_string);
+		week_view->last_edited_comp_string = NULL;
+	}
+	
 	week_view->last_edited_comp_string = e_cal_component_get_as_string (comp);
 
 


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