+2007-06-03 Srinivasa Ragavan <sragavan@novell.com>
+
+ ** Memory leak fixes from bug #440524
+
+ * e-gw-connection.c: (e_gw_connection_get_items_delta_info):
+ * e-gw-item.c: (set_contact_fields_from_soap_parameter):
+
2007-05-07 Matthew Barnes <mbarnes@redhat.com>
* e-gw-item.c:
SoupSoapResponse *response;
EGwConnectionStatus status;
SoupSoapParameter *param, *subparam;
+ char *tmp = NULL;
g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), E_GW_CONNECTION_STATUS_INVALID_OBJECT);
subparam = soup_soap_parameter_get_first_child_by_name (param, "firstSequence");
- if (subparam)
- *first_sequence = strtod (soup_soap_parameter_get_string_value(subparam), NULL);
- else
+ if (subparam) {
+ tmp = soup_soap_parameter_get_string_value(subparam);
+ *first_sequence = strtod (tmp, NULL);
+ g_free (tmp);
+ } else
*first_sequence = -1;
subparam = soup_soap_parameter_get_first_child_by_name (param, "lastSequence");
- if (subparam)
- *last_sequence = strtod (soup_soap_parameter_get_string_value(subparam), NULL);
+ if (subparam) {
+ tmp = soup_soap_parameter_get_string_value(subparam);
+ *last_sequence = strtod (tmp, NULL);
+ g_free (tmp);
+ }
else
*last_sequence = -1;
subparam = soup_soap_parameter_get_first_child_by_name (param, "lastTimePORebuild");
- if (subparam)
- *last_po_rebuild_time = strtod (soup_soap_parameter_get_string_value(subparam), NULL);
- else
+ if (subparam) {
+ tmp = soup_soap_parameter_get_string_value(subparam);
+ *last_po_rebuild_time = strtod (tmp, NULL);
+ g_free (tmp);
+ } else
*last_po_rebuild_time = -1;
g_object_unref (response);
g_hash_table_insert (simple_fields, "default_phone", soup_soap_parameter_get_property(subparam, "default"));
for ( temp = soup_soap_parameter_get_first_child (subparam); temp != NULL; temp = soup_soap_parameter_get_next_child (temp))
{
+ const char *key = NULL;
+
type = soup_soap_parameter_get_property (temp, "type");
value = soup_soap_parameter_get_string_value (temp);
- g_hash_table_insert (item->priv->simple_fields, g_strconcat("phone_", type, NULL) , value);
- g_free (type);
+ switch (*type) {
+ case 'O' :
+ key = "phone_Office";
+ break;
+ case 'H' :
+ key = "phone_Home";
+ break;
+ case 'P' :
+ key = "phone_Pager";
+ break;
+ case 'M' :
+ key = "phone_Mobile";
+ break;
+ case 'F' :
+ key = "phone_Fax";
+ break;
+ default:
+ /* It should never come here. For the worst */
+ key = "phone_";
+ break;
+ };
+
+ if (type) {
+ g_hash_table_insert (item->priv->simple_fields, key, value);
+ g_free (type);
+ }
}
}
subparam = soup_soap_parameter_get_first_child_by_name(param, "personalInfo");
subparam = soup_soap_parameter_get_first_child_by_name (param, "addressList");
if (subparam) {
for ( temp = soup_soap_parameter_get_first_child (subparam); temp != NULL; temp = soup_soap_parameter_get_next_child (temp)) {
-
+ const char *add = NULL;
address = g_new0 (PostalAddress, 1);
set_postal_address_from_soap_parameter (address, temp);
value = soup_soap_parameter_get_property(temp, "type");
- if (value)
- g_hash_table_insert (item->priv->addresses, value, address);
+
+ if (value && value[0] == 'H')
+ add = "Home";
+ else if (value && value[0] == 'O')
+ add = "Office";
+ else
+ add = "Other";
+
+ if (value)
+ g_hash_table_insert (item->priv->addresses, add, address);
else
free_postal_address (address);
+ g_free (value);
}
}