Index: calendar/gui/tasks-component.c
===================================================================
--- calendar/gui/tasks-component.c	(revision 35709)
+++ calendar/gui/tasks-component.c	(working copy)
@@ -204,6 +204,7 @@ ensure_sources (TasksComponent *componen
 		/* Create the default Person addressbook */
 		ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
 		e_source_group_add_source (on_this_computer, source, -1);
+		g_object_unref (source);
 
 		tasks_selected = calendar_config_get_tasks_selected ();
 
Index: calendar/gui/calendar-component.c
===================================================================
--- calendar/gui/calendar-component.c	(revision 35709)
+++ calendar/gui/calendar-component.c	(working copy)
@@ -247,6 +247,7 @@ ensure_sources (CalendarComponent *compo
 		/* Create the default Person addressbook */
 		personal_source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
 		e_source_group_add_source (on_this_computer, personal_source, -1);
+		g_object_unref (personal_source);
 
 		calendars_selected = calendar_config_get_calendars_selected ();
 		if (!primary_calendar && !calendars_selected) {
@@ -295,6 +296,7 @@ ensure_sources (CalendarComponent *compo
 	if (!birthdays_source) {
 		birthdays_source = e_source_new (_("Birthdays & Anniversaries"), "/");
 		e_source_group_add_source (contacts, birthdays_source, -1);
+		g_object_unref (birthdays_source);
 	}
 
 	if (!e_source_get_property (birthdays_source, "delete"))
@@ -312,11 +314,6 @@ ensure_sources (CalendarComponent *compo
 
 	component->priv->source_list = source_list;
 
-	if (personal_source)
-		g_object_unref (personal_source);
-	if (birthdays_source)
-		g_object_unref (birthdays_source);
-
 	g_free (base_uri_proto);
 	g_free (base_uri);
 }
Index: calendar/gui/memos-component.c
===================================================================
--- calendar/gui/memos-component.c	(revision 35709)
+++ calendar/gui/memos-component.c	(working copy)
@@ -208,6 +208,7 @@ ensure_sources (MemosComponent *componen
 		/* Create the default Person addressbook */
 		ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
 		e_source_group_add_source (on_this_computer, source, -1);
+		g_object_unref (source);
 
 		memos_selected = calendar_config_get_memos_selected ();
 
Index: calendar/ChangeLog
===================================================================
--- calendar/ChangeLog	(revision 35709)
+++ calendar/ChangeLog	(working copy)
@@ -1,3 +1,12 @@
+2008-07-02  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #540152
+
+	* gui/calendar-component.c: (ensure_sources):
+	Unref only sources when we created it - the list owns the pointer now.
+	* gui/tasks-component.c: (ensure_sources):
+	* gui/memos-component.c: (ensure_sources): Do not leak ESource.
+
 2008-06-16  Maciej Piechotka <uzytkownik2@gmail.com>
 
 	* gui/caltypes.xml:
