evolution-data-server r8515 - in trunk: calendar calendar/backends/groupwise servers/groupwise



Author: mcrha
Date: Wed Feb 20 11:11:08 2008
New Revision: 8515
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8515&view=rev

Log:
2008-02-20  Milan Crha  <mcrha redhat com>

	** Fixes part of bug #510949

	* servers/groupwise/e-gw-sendoptions.c:
	* servers/groupwise/e-gw-proxy.c:
	* servers/groupwise/e-gw-item.c:
	* servers/groupwise/e-gw-connection.c:
	* calendar/backends/groupwise/e-cal-backend-groupwise-utils.c:
	Memory leak fixes.



Modified:
   trunk/calendar/ChangeLog
   trunk/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c
   trunk/servers/groupwise/ChangeLog
   trunk/servers/groupwise/e-gw-connection.c
   trunk/servers/groupwise/e-gw-item.c
   trunk/servers/groupwise/e-gw-proxy.c
   trunk/servers/groupwise/e-gw-sendoptions.c

Modified: trunk/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c
==============================================================================
--- trunk/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c	(original)
+++ trunk/calendar/backends/groupwise/e-cal-backend-groupwise-utils.c	Wed Feb 20 11:11:08 2008
@@ -1678,7 +1678,8 @@
         SoupSoapResponse *response;
         EGwConnectionStatus status;
         SoupSoapParameter *param, *subparam, *param_outstanding;
-        const char *session, *outstanding = NULL;
+        const char *session;
+	char *outstanding = NULL;
 	gboolean resend_request = TRUE;
 	int request_iteration = 0;
 
@@ -1732,8 +1733,10 @@
 		g_object_unref (msg);
 		g_object_unref (response);
 		g_usleep (10000000);
+		g_free (outstanding); outstanding = NULL;
 		goto resend;
 	}
+	g_free (outstanding); outstanding = NULL;
 
         /* FIXME  the FreeBusyStats are not used currently.  */
         param = soup_soap_response_get_first_parameter_by_name (response, "freeBusyInfo");
@@ -1749,7 +1752,7 @@
 	     subparam != NULL;
 	     subparam = soup_soap_parameter_get_next_child_by_name (subparam, "user")) {
 		SoupSoapParameter *param_blocks, *subparam_block, *tmp;
-		const char *uuid = NULL, *email = NULL, *name = NULL;
+		char *uuid = NULL, *email = NULL, *name = NULL;
 		ECalComponent *comp;
 		ECalComponentAttendee attendee;
 		GSList *attendee_list = NULL;
@@ -1782,6 +1785,7 @@
 
 		/* XXX the uuid is not currently used. hence it is
 		 * discarded */
+		g_free (uuid); uuid = NULL;
 
 		attendee_list = g_slist_append (attendee_list, &attendee);
 
@@ -1807,7 +1811,7 @@
 			icalproperty *icalprop;
 			icaltimetype itt;
 			time_t t;
-			const char *start, *end, *accept_level;
+			char *start, *end, *accept_level;
 
 			memset (&ipt, 0, sizeof (struct icalperiodtype));
 			tmp = soup_soap_parameter_get_first_child_by_name (subparam_block, "startDate");
@@ -1816,6 +1820,7 @@
 				t = e_gw_connection_get_date_from_string (start);
 				itt = icaltime_from_timet_with_zone (t, 0, default_zone ? default_zone : NULL);
 				ipt.start = itt;
+				g_free (start);
 			}
 
 			tmp = soup_soap_parameter_get_first_child_by_name (subparam_block, "endDate");
@@ -1824,6 +1829,7 @@
 				t = e_gw_connection_get_date_from_string (end);
 				itt = icaltime_from_timet_with_zone (t, 0, default_zone ? default_zone : NULL);
 				ipt.end = itt;
+				g_free (end);
 			}
 			icalprop = icalproperty_new_freebusy (ipt);
 
@@ -1838,9 +1844,9 @@
 					icalproperty_set_parameter_from_string (icalprop, "FBTYPE", "BUSYUNAVAILABLE");
 				else if (!strcmp (accept_level, "Free"))
 					icalproperty_set_parameter_from_string (icalprop, "FBTYPE", "FREE");
-							}
+				g_free (accept_level);
+			}
 			icalcomponent_add_property(icalcomp, icalprop);
-
 		}
 
 		e_cal_component_commit_sequence (comp);

Modified: trunk/servers/groupwise/e-gw-connection.c
==============================================================================
--- trunk/servers/groupwise/e-gw-connection.c	(original)
+++ trunk/servers/groupwise/e-gw-connection.c	Wed Feb 20 11:11:08 2008
@@ -524,10 +524,10 @@
 			response = e_gw_connection_send_message (cnc, msg);
 			status = e_gw_connection_parse_response_status (response);
 			g_strfreev (tokens);
-			g_free (host);
-			g_free (port);
 		}
 
+		g_free (host);
+		g_free (port);
 	}
 	param = soup_soap_response_get_first_parameter_by_name (response, "session");
 	if (!param) {
@@ -1053,6 +1053,7 @@
         SoupSoapResponse *response;
         EGwConnectionStatus status;
         SoupSoapParameter *param, *subparam;
+	char *tmp;
 
  	g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
 
@@ -1094,11 +1095,15 @@
                  return E_GW_CONNECTION_STATUS_INVALID_RESPONSE;
          }
 
-         if (!g_ascii_strcasecmp ( soup_soap_parameter_get_string_value (param), "0")) {
+	tmp = soup_soap_parameter_get_string_value (param);
+	if (!g_ascii_strcasecmp (tmp, "0")) {
+		g_free (tmp);
                  g_message ("No deltas");
 		 // g_object_unref (cnc);
                  return E_GW_CONNECTION_STATUS_OK;
-         }
+        }
+
+	g_free (tmp);
 
          param = soup_soap_response_get_first_parameter_by_name (response, "deltas");
          if (!param) {
@@ -1270,7 +1275,7 @@
 	if (status == E_GW_CONNECTION_STATUS_OK) {
 		param = soup_soap_response_get_first_parameter_by_name (response, "id");
 		if (param != NULL)
-			*id = g_strdup (soup_soap_parameter_get_string_value (param));
+			*id = soup_soap_parameter_get_string_value (param);
 	} else if (status == E_GW_CONNECTION_STATUS_INVALID_CONNECTION)
 		reauthenticate (cnc);
 
@@ -2132,9 +2137,10 @@
 			if (categories_by_name)
 				g_hash_table_insert (priv->categories_by_name, g_strdup (name), g_strdup (id));
 			g_strfreev (components);
-			g_free (name);
+			id = NULL;
 		}
-
+		g_free (id);
+		g_free (name);
         }
 
 	/* free memory */
@@ -3259,23 +3265,20 @@
 				if (val_param)
 					val = soup_soap_parameter_get_int_value (val_param);
 				*use_junk = val;
-				g_free (field);
 			} else	if (!g_ascii_strcasecmp (field, "useBlockList")) {
 				if (val_param)
 					val = soup_soap_parameter_get_int_value (val_param);
 				*use_block = val;
-				g_free (field);
 			} else if (!g_ascii_strcasecmp (field, "usePAB")) {
 				if (val_param)
 					val = soup_soap_parameter_get_int_value (val_param);
 				*use_pab = val;
-				g_free (field);
 			} else if (!g_ascii_strcasecmp (field, "persistence")) {
 				if (val_param)
 					val = soup_soap_parameter_get_int_value (val_param);
 				*persistence = val;
-				g_free (field);
 			}
+			g_free (field);
 		}
 	}
 }

Modified: trunk/servers/groupwise/e-gw-item.c
==============================================================================
--- trunk/servers/groupwise/e-gw-item.c	(original)
+++ trunk/servers/groupwise/e-gw-item.c	Wed Feb 20 11:11:08 2008
@@ -746,6 +746,7 @@
 			value = soup_soap_parameter_get_string_value (child);
 			if (value && !g_ascii_strcasecmp (value, "1"))
 				priv->reply_request_set = TRUE;
+			g_free (value), value = NULL;
 		}
 
 		if (!priv->reply_request_set) {
@@ -1169,7 +1170,6 @@
 				const char *key = NULL;
 
 				type =  soup_soap_parameter_get_property (temp, "type");
-				value = soup_soap_parameter_get_string_value (temp);
 				switch (*type) {
 					case 'O' :
 						key = "phone_Office";
@@ -1193,6 +1193,7 @@
 				};
 
 				if (type) {
+					value = soup_soap_parameter_get_string_value (temp);
 					g_hash_table_insert (item->priv->simple_fields, (char*)key, value);
 					g_free (type);
 				}
@@ -1306,9 +1307,10 @@
 				second_level_child = soup_soap_parameter_get_first_child_by_name (temp, "name");
 				member->name =  soup_soap_parameter_get_string_value (second_level_child);
 				item->priv->member_list = g_list_append (item->priv->member_list, member);
+			} else {
+				g_free (id);
+				g_free (email);
 			}
-
-
 		}
 	}
 
@@ -2027,8 +2029,8 @@
 				/* convert it into integer */
 				item->priv->trigger = atoi (value);
 				g_free (value);
-				g_free (enabled);
 			}
+			g_free (enabled);
 		}
 
 	}

Modified: trunk/servers/groupwise/e-gw-proxy.c
==============================================================================
--- trunk/servers/groupwise/e-gw-proxy.c	(original)
+++ trunk/servers/groupwise/e-gw-proxy.c	Wed Feb 20 11:11:08 2008
@@ -50,20 +50,20 @@
 		value = NULL;
 		if (type_param)	{
 			value = soup_soap_parameter_get_string_value (type_param);
-			aclInstance->proxy_email = g_strdup_printf("%s", value);
+			aclInstance->proxy_email = value;
 		}
 
 		type_param = soup_soap_parameter_get_first_child_by_name (subparam, "displayName");
 		value = NULL;
 		if (type_param)	{
 			value = soup_soap_parameter_get_string_value (type_param);
-			aclInstance->proxy_name = g_strdup_printf ("%s", value);
+			aclInstance->proxy_name = value;
 		}
 		type_param = soup_soap_parameter_get_first_child_by_name (subparam, "id");
 		value = NULL;
 		if (type_param)	{
 			value = soup_soap_parameter_get_string_value (type_param);
-			aclInstance->uniqueid = g_strdup_printf ("%s", value);
+			aclInstance->uniqueid = value;
 		} else
 			aclInstance->uniqueid = NULL;
 
@@ -72,97 +72,69 @@
 		if (type_param)	{
 			individual_rights= soup_soap_parameter_get_first_child_by_name (type_param,"read");
 			if (individual_rights) {
-				value = soup_soap_parameter_get_string_value (individual_rights);
 				aclInstance->permissions |= E_GW_PROXY_MAIL_READ;
 			}
 			individual_rights= soup_soap_parameter_get_first_child_by_name (type_param,"write");
 			if (individual_rights) {
-				value = soup_soap_parameter_get_string_value (individual_rights);
 				aclInstance->permissions |= E_GW_PROXY_MAIL_WRITE;
 			}
 		}
 
-		if (value)
-			g_free (value);
-
-		value = NULL;
 		type_param = soup_soap_parameter_get_first_child_by_name (subparam, "appointment");
 		if (type_param) {
 			individual_rights= soup_soap_parameter_get_first_child_by_name (type_param,"read");
 			if (individual_rights) {
-				value = soup_soap_parameter_get_string_value (individual_rights);
 				aclInstance->permissions |= E_GW_PROXY_APPOINTMENT_READ;
 			}
 			individual_rights= soup_soap_parameter_get_first_child_by_name (type_param,"write");
 			if (individual_rights) {
-				value = soup_soap_parameter_get_string_value (individual_rights);
 				aclInstance->permissions |= E_GW_PROXY_APPOINTMENT_WRITE;
 			}
 		}
-		if (value)
-			g_free (value);
 
-		value = NULL;
 		type_param = soup_soap_parameter_get_first_child_by_name (subparam, "task");
 		if (type_param)	{
 			individual_rights= soup_soap_parameter_get_first_child_by_name (type_param,"read");
 			if (individual_rights) {
-				value = soup_soap_parameter_get_string_value (individual_rights);
 				aclInstance->permissions |= E_GW_PROXY_TASK_READ;
 			}
 			individual_rights= soup_soap_parameter_get_first_child_by_name (type_param,"write");
 			if (individual_rights) {
-				value = soup_soap_parameter_get_string_value (individual_rights);
 				aclInstance->permissions |= E_GW_PROXY_TASK_WRITE;
 			}
 		}
-		if (value)
-			g_free (value);
 
-		value = NULL;
 		type_param = soup_soap_parameter_get_first_child_by_name (subparam, "note");
 		if (type_param)	{
 			individual_rights= soup_soap_parameter_get_first_child_by_name (type_param,"read");
 			if (individual_rights) {
-				value = soup_soap_parameter_get_string_value (individual_rights);
 				aclInstance->permissions |= E_GW_PROXY_NOTES_READ;
 			}
 			individual_rights= soup_soap_parameter_get_first_child_by_name (type_param,"write");
 			if (individual_rights) {
-				value = soup_soap_parameter_get_string_value (individual_rights);
 				aclInstance->permissions |= E_GW_PROXY_NOTES_WRITE;
 			}
 		}
-		if (value)
-			g_free (value);
-
 
 		type_param = soup_soap_parameter_get_first_child_by_name (subparam, "misc");
-		value = NULL;
 		if (type_param)	{
 			individual_rights= soup_soap_parameter_get_first_child_by_name (type_param,"alarms");
 			if (individual_rights) {
-				value = soup_soap_parameter_get_string_value (individual_rights);
 				aclInstance->permissions |= E_GW_PROXY_GET_ALARMS;
 			}
 			individual_rights= soup_soap_parameter_get_first_child_by_name (type_param,"notify");
 			if (individual_rights) {
-				value = soup_soap_parameter_get_string_value (individual_rights);
 				aclInstance->permissions |= E_GW_PROXY_GET_NOTIFICATIONS;
 			}
 			individual_rights= soup_soap_parameter_get_first_child_by_name (type_param,"setup");
 			if (individual_rights) {
-				value = soup_soap_parameter_get_string_value (individual_rights);
 				aclInstance->permissions |= E_GW_PROXY_MODIFY_FOLDERS;
 			}
 			individual_rights= soup_soap_parameter_get_first_child_by_name (type_param,"readHidden");
 			if (individual_rights) {
-				value = soup_soap_parameter_get_string_value (individual_rights);
 				aclInstance->permissions |= E_GW_PROXY_READ_PRIVATE;
 			}
 		}
-		if (value)
-			g_free(value);
 
 		*proxy_list = g_list_append(*proxy_list, aclInstance);
 	}
@@ -337,104 +309,74 @@
 e_gw_proxy_parse_proxy_login_response (SoupSoapParameter *param, int *permissions)
 {
 	SoupSoapParameter *subparam;
-	char *value;
 	SoupSoapParameter *individual_rights;
 
 	*permissions = 0;
 	subparam = soup_soap_parameter_get_first_child_by_name (param, "mail");
-	value = NULL;
 	if (subparam) {
 		individual_rights= soup_soap_parameter_get_first_child_by_name (subparam,"read");
 		if (individual_rights) {
-			value = soup_soap_parameter_get_string_value (individual_rights);
 			*permissions |= E_GW_PROXY_MAIL_READ;
 		}
 		individual_rights= soup_soap_parameter_get_first_child_by_name (subparam,"write");
 		if (individual_rights) {
-			value = soup_soap_parameter_get_string_value (individual_rights);
 			*permissions |= E_GW_PROXY_MAIL_WRITE;
 		}
 	}
 
-	if (value)
-		g_free (value);
-
-	value = NULL;
 	subparam = soup_soap_parameter_get_first_child_by_name (param, "appointment");
 	if (subparam) {
 		individual_rights= soup_soap_parameter_get_first_child_by_name (subparam,"read");
 		if (individual_rights) {
-			value = soup_soap_parameter_get_string_value (individual_rights);
 			*permissions |= E_GW_PROXY_APPOINTMENT_READ;
 		}
 		individual_rights= soup_soap_parameter_get_first_child_by_name (subparam,"write");
 		if (individual_rights) {
-			value = soup_soap_parameter_get_string_value (individual_rights);
 			*permissions |= E_GW_PROXY_APPOINTMENT_WRITE;
 		}
 	}
-	if (value)
-		g_free (value);
 
-	value = NULL;
 	subparam = soup_soap_parameter_get_first_child_by_name (param, "task");
 	if (subparam)	{
 		individual_rights= soup_soap_parameter_get_first_child_by_name (subparam,"read");
 		if (individual_rights) {
-			value = soup_soap_parameter_get_string_value (individual_rights);
 			*permissions |= E_GW_PROXY_TASK_READ;
 		}
 		individual_rights= soup_soap_parameter_get_first_child_by_name (subparam,"write");
 		if (individual_rights) {
-			value = soup_soap_parameter_get_string_value (individual_rights);
 			*permissions |= E_GW_PROXY_TASK_WRITE;
 		}
 	}
-	if (value)
-		g_free (value);
 
-	value = NULL;
 	subparam = soup_soap_parameter_get_first_child_by_name (param, "note");
 	if (subparam)	{
 		individual_rights= soup_soap_parameter_get_first_child_by_name (subparam,"read");
 		if (individual_rights) {
-			value = soup_soap_parameter_get_string_value (individual_rights);
 			*permissions |= E_GW_PROXY_NOTES_READ;
 		}
 		individual_rights= soup_soap_parameter_get_first_child_by_name (subparam,"write");
 		if (individual_rights) {
-			value = soup_soap_parameter_get_string_value (individual_rights);
 			*permissions |= E_GW_PROXY_NOTES_WRITE;
 		}
 	}
-	if (value)
-		g_free (value);
-
 
 	subparam = soup_soap_parameter_get_first_child_by_name (param, "misc");
-	value = NULL;
 	if (subparam)	{
 		individual_rights= soup_soap_parameter_get_first_child_by_name (subparam,"alarms");
 		if (individual_rights) {
-			value = soup_soap_parameter_get_string_value (individual_rights);
 			*permissions |= E_GW_PROXY_GET_ALARMS;
 		}
 		individual_rights= soup_soap_parameter_get_first_child_by_name (subparam,"notify");
 		if (individual_rights) {
-			value = soup_soap_parameter_get_string_value (individual_rights);
 			*permissions |= E_GW_PROXY_GET_NOTIFICATIONS;
 		}
 		individual_rights= soup_soap_parameter_get_first_child_by_name (subparam,"setup");
 		if (individual_rights) {
-			value = soup_soap_parameter_get_string_value (individual_rights);
 			*permissions |= E_GW_PROXY_MODIFY_FOLDERS;
 		}
 		individual_rights= soup_soap_parameter_get_first_child_by_name (subparam,"readHidden");
 		if (individual_rights) {
-			value = soup_soap_parameter_get_string_value (individual_rights);
 			*permissions |= E_GW_PROXY_READ_PRIVATE;
 		}
 	}
-	if (value)
-		g_free(value);
 }

Modified: trunk/servers/groupwise/e-gw-sendoptions.c
==============================================================================
--- trunk/servers/groupwise/e-gw-sendoptions.c	(original)
+++ trunk/servers/groupwise/e-gw-sendoptions.c	Wed Feb 20 11:11:08 2008
@@ -391,6 +391,9 @@
 			} else
 				gopts->delay_enabled = FALSE;
 		}
+
+		g_free (field);
+		g_free (val);
 	}
 }
 



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