[evolution-mapi] Bug #627703 - Crash on double free while fetching Free/Busy



commit 3b7061d1f9aa02ece476839af2946cb3e6f4bc6f
Author: Milan Crha <mcrha redhat com>
Date:   Thu Aug 26 09:40:57 2010 +0200

    Bug #627703 - Crash on double free while fetching Free/Busy

 src/calendar/e-cal-backend-mapi.c             |    3 +++
 src/libexchangemapi/exchange-mapi-cal-utils.c |   11 +++--------
 src/libexchangemapi/exchange-mapi-cal-utils.h |    2 +-
 3 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/src/calendar/e-cal-backend-mapi.c b/src/calendar/e-cal-backend-mapi.c
index d98ed74..36f5324 100644
--- a/src/calendar/e-cal-backend-mapi.c
+++ b/src/calendar/e-cal-backend-mapi.c
@@ -3495,6 +3495,9 @@ ecbm_op_get_free_busy (ECalBackend *backend, EDataCal *cal, EServerMethodContext
 	priv = cbmapi->priv;
 	g_return_if_fail (priv != NULL);
 
+	if (cal)
+		g_object_ref (cal);
+
 	op = g_new0 (OperationGetFreeBusy, 1);
 	op->base.ot = OP_GET_FREE_BUSY;
 	op->base.cal = cal;
diff --git a/src/libexchangemapi/exchange-mapi-cal-utils.c b/src/libexchangemapi/exchange-mapi-cal-utils.c
index 753ad0a..e710ea3 100644
--- a/src/libexchangemapi/exchange-mapi-cal-utils.c
+++ b/src/libexchangemapi/exchange-mapi-cal-utils.c
@@ -1936,13 +1936,13 @@ populate_freebusy_data (struct Binary_r *bin, uint32_t month, uint32_t year, GLi
 }
 
 gboolean
-exchange_mapi_cal_utils_get_free_busy_data (ExchangeMapiConnection *conn, GList *users, time_t start, time_t end, GList **freebusy, GError **mapi_error)
+exchange_mapi_cal_utils_get_free_busy_data (ExchangeMapiConnection *conn, const GList *users, time_t start, time_t end, GList **freebusy, GError **mapi_error)
 {
 	struct SRow		aRow;
 	enum MAPISTATUS		ms;
 	uint32_t		i;
 	mapi_object_t           obj_store;
-	GList *l;
+	const GList *l;
 
 	const uint32_t			*publish_start;
 	const struct LongArray_r	*busy_months;
@@ -1954,7 +1954,6 @@ exchange_mapi_cal_utils_get_free_busy_data (ExchangeMapiConnection *conn, GList
 	uint32_t			year;
 	uint32_t			event_year;
 
-	gchar *name = NULL;
 	ECalComponent *comp;
 	ECalComponentAttendee attendee;
 	GSList *attendee_list = NULL;
@@ -2001,8 +2000,6 @@ exchange_mapi_cal_utils_get_free_busy_data (ExchangeMapiConnection *conn, GList
 		icalcomponent_set_dtend (icalcomp, end_time);
 
 		memset (&attendee, 0, sizeof (ECalComponentAttendee));
-		if (name)
-			attendee.cn = name;
 		if (l->data)
 			attendee.value = l->data;
 
@@ -2014,8 +2011,6 @@ exchange_mapi_cal_utils_get_free_busy_data (ExchangeMapiConnection *conn, GList
 
 		e_cal_component_set_attendee_list (comp, attendee_list);
 		g_slist_free (attendee_list);
-		g_free ((gchar *) name);
-		g_free ((gchar *) l->data);
 
 		if (busy_months && ((*(const uint32_t *) busy_months) != MAPI_E_NOT_FOUND) &&
 		    busy_events && ((*(const uint32_t *) busy_events) != MAPI_E_NOT_FOUND)) {
@@ -2043,7 +2038,7 @@ exchange_mapi_cal_utils_get_free_busy_data (ExchangeMapiConnection *conn, GList
 
 		e_cal_component_commit_sequence (comp);
 		*freebusy = g_list_append (*freebusy, e_cal_component_get_as_string (comp));
-//		g_object_unref (comp);
+		g_object_unref (comp);
 		MAPIFreeBuffer(aRow.lpProps);
 	}
 
diff --git a/src/libexchangemapi/exchange-mapi-cal-utils.h b/src/libexchangemapi/exchange-mapi-cal-utils.h
index 9c74e7e..9ac1f4c 100644
--- a/src/libexchangemapi/exchange-mapi-cal-utils.h
+++ b/src/libexchangemapi/exchange-mapi-cal-utils.h
@@ -101,7 +101,7 @@ gboolean exchange_mapi_cal_utils_add_named_ids (ExchangeMapiConnection *conn, ma
 gboolean exchange_mapi_cal_utils_get_props_cb (ExchangeMapiConnection *conn, mapi_id_t fid, TALLOC_CTX *mem_ctx, struct SPropTagArray *props, gpointer data);
 gboolean exchange_mapi_cal_utils_write_props_cb (ExchangeMapiConnection *conn, mapi_id_t fid, TALLOC_CTX *mem_ctx, struct SPropValue **values, uint32_t *n_values, gpointer data);
 
-gboolean exchange_mapi_cal_utils_get_free_busy_data (ExchangeMapiConnection *conn, GList *users, time_t start, time_t end, GList **freebusy, GError **mapi_error);
+gboolean exchange_mapi_cal_utils_get_free_busy_data (ExchangeMapiConnection *conn, const GList *users, time_t start, time_t end, GList **freebusy, GError **mapi_error);
 
 G_END_DECLS
 



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