evolution-exchange r1584 - in trunk: . calendar mail



Author: pchen
Date: Sun Feb 24 18:57:47 2008
New Revision: 1584
URL: http://svn.gnome.org/viewvc/evolution-exchange?rev=1584&view=rev

Log:
2008-02-25  Chenthill Palanisamy  <pchenthill novell com>

        Fixes #516408
        * calendar/e-cal-backend-exchange-calendar.c (add_ical),
        (create_object), (modify_object_with_href), (remove_object),
        (receive_objects), (get_free_busy):
        * calendar/e-cal-backend-exchange-tasks.c (get_changed_tasks),
        (receive_task_objects):
        * calendar/e-cal-backend-exchange.c (timeout_save_cache),
        (uncache), (get_object), (get_default_object), (get_timezone):
        * mail/mail-utils.c
        * (mail_util_demangle_meeting_related_message): Free
        the memory returned by libical.



Modified:
   trunk/ChangeLog
   trunk/calendar/e-cal-backend-exchange-calendar.c
   trunk/calendar/e-cal-backend-exchange-tasks.c
   trunk/calendar/e-cal-backend-exchange.c
   trunk/mail/mail-utils.c

Modified: trunk/calendar/e-cal-backend-exchange-calendar.c
==============================================================================
--- trunk/calendar/e-cal-backend-exchange-calendar.c	(original)
+++ trunk/calendar/e-cal-backend-exchange-calendar.c	Sun Feb 24 18:57:47 2008
@@ -235,7 +235,7 @@
 		status = add_vevent (cbex, href, lastmod, icalcomp);
 
 		if (status) {
-			char *object = g_strdup (icalcomponent_as_ical_string (icalcomp));
+			char *object = icalcomponent_as_ical_string (icalcomp);
 			e_cal_backend_notify_object_created (backend, object);
 			g_free (object);
 		}
@@ -270,7 +270,7 @@
 			status = add_vevent (cbex, href, lastmod, new_comp);
 
 			if (status) {
-				char *object = g_strdup (icalcomponent_as_ical_string (new_comp));
+				char *object = icalcomponent_as_ical_string (new_comp);
 				e_cal_backend_notify_object_created (backend, object);
 				g_free (object);
 			}
@@ -833,6 +833,7 @@
 
 	body = icalcomponent_as_ical_string (cbdata->vcal_comp);
 	body_crlf = e_cal_backend_exchange_lf_to_crlf (body);
+	g_free (body);
 
 	date = e_cal_backend_exchange_make_timestamp_rfc822 (time (NULL));
 	if (!g_ascii_strcasecmp(e_cal_backend_exchange_get_owner_email (backend), exchange_account_get_email_id (cbex->account)))
@@ -1353,13 +1354,14 @@
 	e_cal_backend_exchange_cache_unlock (cbex);
 
 	if (!cached_ecomp && remove)
-		*new_object = g_strdup (icalcomponent_as_ical_string (icalcomp));
+		*new_object = icalcomponent_as_ical_string (icalcomp);
 
 	if (!remove && mod == CALOBJ_MOD_THIS)
 		icalcomponent_add_component (cbdata->vcal_comp, real_icalcomp);
 
 	body = icalcomponent_as_ical_string (cbdata->vcal_comp);
 	body_crlf = e_cal_backend_exchange_lf_to_crlf (body);
+	g_free (body);
 
 	date = e_cal_backend_exchange_make_timestamp_rfc822 (time (NULL));
 	if (!g_ascii_strcasecmp(e_cal_backend_exchange_get_owner_email (backend), exchange_account_get_email_id (cbex->account)))
@@ -1510,6 +1512,7 @@
 		e_cal_backend_exchange_cache_unlock (cbex);
 		ebs_status = modify_object_with_href (backend, cal, calobj, mod, &obj, &new_object, NULL, rid);
 		g_object_unref (comp);
+		g_free (calobj);
 		if (ebs_status != GNOME_Evolution_Calendar_Success)
 			goto error;
 		if (obj) {
@@ -1636,6 +1639,7 @@
 									      old_object, new_object);
 					g_free (new_object);
 					d(printf ("Notify that the new object after modication is : %s\n", icalobj));
+					g_free (icalobj);
 				}
 
 				g_free (old_object);
@@ -1650,10 +1654,10 @@
 				if (status != GNOME_Evolution_Calendar_Success)
 					goto error;
 
-				object = g_strdup (icalobj);
+				object = icalobj;
 				e_cal_backend_notify_object_created (E_CAL_BACKEND (backend), icalobj);
-				g_free (object);
 				d(printf ("Notify that the new object is created : %s\n", icalobj));
+				g_free (object);
 			} else {
 				e_cal_backend_exchange_cache_unlock (cbex);
 				status = GNOME_Evolution_Calendar_Success;
@@ -1680,6 +1684,7 @@
 				g_free (object);
 				object = NULL;
 			}
+			g_free (icalobj);
 			break;
 		default:
 			status = GNOME_Evolution_Calendar_UnsupportedMethod;
@@ -2284,7 +2289,7 @@
 		set_freebusy_info (vfb, content, start);
 
 		calobj = icalcomponent_as_ical_string (vfb);
-		*freebusy = g_list_prepend (*freebusy, g_strdup (calobj));
+		*freebusy = g_list_prepend (*freebusy, calobj);
 		icalcomponent_free (vfb);
 	}
 	xmlFreeDoc (doc);

Modified: trunk/calendar/e-cal-backend-exchange-tasks.c
==============================================================================
--- trunk/calendar/e-cal-backend-exchange-tasks.c	(original)
+++ trunk/calendar/e-cal-backend-exchange-tasks.c	Sun Feb 24 18:57:47 2008
@@ -830,8 +830,11 @@
 					modtime, icalcomp);
 			e_cal_backend_exchange_cache_unlock (cbex);
 
-			if (status && kind == ICAL_VTODO_COMPONENT)
-				e_cal_backend_notify_object_created (E_CAL_BACKEND (cbex), icalcomponent_as_ical_string (icalcomp));
+			if (status && kind == ICAL_VTODO_COMPONENT) {
+				char *str = icalcomponent_as_ical_string (icalcomp);
+				e_cal_backend_notify_object_created (E_CAL_BACKEND (cbex), str);
+				g_free (str);
+			}
 
 		}
 	} /* End while */
@@ -1362,10 +1365,13 @@
 			e_cal_backend_exchange_cache_unlock (cbex);
 			calobj = (char *) icalcomponent_as_ical_string (subcomp);
 			status = create_task_object (backend, cal, &calobj, &returned_uid);
-                        if (status != GNOME_Evolution_Calendar_Success)
+                        if (status != GNOME_Evolution_Calendar_Success) {
+				g_free (calobj);
                                 goto error;
+			}
 
                         e_cal_backend_notify_object_created (E_CAL_BACKEND (backend), calobj);
+			g_free (calobj);
                 }
         }
 

Modified: trunk/calendar/e-cal-backend-exchange.c
==============================================================================
--- trunk/calendar/e-cal-backend-exchange.c	(original)
+++ trunk/calendar/e-cal-backend-exchange.c	Sun Feb 24 18:57:47 2008
@@ -267,7 +267,7 @@
 {
 	ECalBackendExchange *cbex = user_data;
 	icalcomponent *vcalcomp;
-	char *data, *tmpfile;
+	char *data = NULL, *tmpfile;
 	size_t len, nwrote;
 	FILE *f;
 
@@ -294,6 +294,7 @@
 		unlink (tmpfile);
 error:
 	g_free (tmpfile);
+	g_free (data);
 	return FALSE;
 }
 
@@ -574,10 +575,13 @@
 	id->uid = g_strdup (key);
 	id->rid = NULL;
 	if (ecomp->icomp) {
+		char *str = NULL;
 		/* FIXME somehow the query does not match with the component in some cases, so user needs to press a
 		   clear to get rid of the component from the view in that case*/
+		str = icalcomponent_as_ical_string (ecomp->icomp);
 		e_cal_backend_notify_object_removed (backend, id, icalcomponent_as_ical_string (ecomp->icomp)
 				, NULL);
+		g_free (str);
 	}
 	g_hash_table_remove (cbex->priv->objects, key);
 	e_cal_component_free_id (id);
@@ -868,7 +872,7 @@
 		}
 
 		if (inst_found) {
-			*object = g_strdup (icalcomponent_as_ical_string (l->data));
+			*object = icalcomponent_as_ical_string (l->data);
 		} else {
 			/* Instance is not found. Send the master object instead */
 			if (ecomp->icomp) {
@@ -882,7 +886,7 @@
 					return GNOME_Evolution_Calendar_ObjectNotFound;
 				}
 
-				*object = g_strdup (icalcomponent_as_ical_string (new_inst));
+				*object = icalcomponent_as_ical_string (new_inst);
 				icalcomponent_free (new_inst);
 			} else {
 				/* Oops. No instance and no master as well !! */
@@ -905,11 +909,11 @@
 					icalcomponent_new_clone (ecomp->icomp));
 			g_list_foreach (ecomp->instances, (GFunc) add_instances_to_vcal, vcalcomp);
 
-			*object = g_strdup (icalcomponent_as_ical_string (vcalcomp));
+			*object = icalcomponent_as_ical_string (vcalcomp);
 			icalcomponent_free (vcalcomp);
 		} else {
 			/* There are no detached instances. Send only the master object */
-			*object = g_strdup (icalcomponent_as_ical_string (ecomp->icomp));
+			*object = icalcomponent_as_ical_string (ecomp->icomp);
 		}
 	}
 	g_mutex_unlock (cbex->priv->cache_lock);
@@ -1003,7 +1007,7 @@
 
 	comp = e_cal_util_new_component (e_cal_backend_get_kind (E_CAL_BACKEND (backend)));
 	ical_obj = icalcomponent_as_ical_string (comp);
-	*object = g_strdup (ical_obj);
+	*object = ical_obj;
 
 	icalcomponent_free (comp);
 
@@ -1132,7 +1136,7 @@
 		return GNOME_Evolution_Calendar_OtherError;
 
 	ical_obj = icalcomponent_as_ical_string (vtzcomp);
-	*object = g_strdup (ical_obj);
+	*object = ical_obj;
 
 	return  GNOME_Evolution_Calendar_Success;
 }

Modified: trunk/mail/mail-utils.c
==============================================================================
--- trunk/mail/mail-utils.c	(original)
+++ trunk/mail/mail-utils.c	Sun Feb 24 18:57:47 2008
@@ -321,7 +321,7 @@
 	icalcomponent *vcal_comp, *event_comp;
 	icalproperty *prop = NULL;
 	char *vstart, *vend;
-	char *ical_str;
+	char *ical_str, *str;
 	int oldlen, newlen;
 	gboolean modify_prop = FALSE;
 
@@ -425,7 +425,9 @@
 	}
 
 	/* Put the updated ical string back into the body */
-	ical_str = e2k_lf_to_crlf (icalcomponent_as_ical_string (vcal_comp));
+	str = icalcomponent_as_ical_string (vcal_comp);
+	ical_str = e2k_lf_to_crlf (str);
+	g_free (str);
 	newlen = strlen (ical_str);
 	if (newlen < oldlen) {
 		memcpy (vstart, ical_str, newlen);



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