From 7d17af894b3e2663c4d32405af0949bc34b24a8f Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Tue, 14 Aug 2001 04:16:13 +0000 Subject: don't g_strdup the stuff we're passing into e_list_append, since it does 2001-08-13 Chris Toshok * backend/pas/pas-backend-ldap.c (add_to_supported_fields): don't g_strdup the stuff we're passing into e_list_append, since it does the copy for us. (check_schema_support): don't initialize supported_fields list here, since there's a gross case where the programmer/user can bring up the contact editor before the connection stuff is finished, and we don't want to crash. (pas_backend_ldap_init): move it here to we can guarantee it's there. (bug #6546). svn path=/trunk/; revision=11989 --- addressbook/backend/pas/pas-backend-ldap.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'addressbook/backend') diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c index 804012d983..2d726483a7 100644 --- a/addressbook/backend/pas/pas-backend-ldap.c +++ b/addressbook/backend/pas/pas-backend-ldap.c @@ -289,18 +289,18 @@ add_to_supported_fields (PASBackendLDAP *bl, char **attrs, GHashTable *attr_hash char *query_prop = g_hash_table_lookup (attr_hash, attrs[i]); if (query_prop) { - e_list_append (bl->priv->supported_fields, g_strdup(query_prop)); + e_list_append (bl->priv->supported_fields, query_prop); /* handle the list attributes here */ if (!strcmp (query_prop, "email")) { - e_list_append (bl->priv->supported_fields, g_strdup("email_2")); - e_list_append (bl->priv->supported_fields, g_strdup("email_3")); + e_list_append (bl->priv->supported_fields, "email_2"); + e_list_append (bl->priv->supported_fields, "email_3"); } else if (!strcmp (query_prop, "business_phone")) { - e_list_append (bl->priv->supported_fields, g_strdup("business_phone_2")); + e_list_append (bl->priv->supported_fields, "business_phone_2"); } else if (!strcmp (query_prop, "home_phone")) { - e_list_append (bl->priv->supported_fields, g_strdup("home_phone_2")); + e_list_append (bl->priv->supported_fields, "home_phone_2"); } } } @@ -333,8 +333,6 @@ check_schema_support (PASBackendLDAP *bl) bl->priv->evolutionPersonChecked = TRUE; - bl->priv->supported_fields = e_list_new ((EListCopyFunc)g_strdup, (EListFreeFunc)g_free, NULL); - attrs[0] = "objectClasses"; attrs[1] = NULL; @@ -2420,7 +2418,9 @@ pas_backend_ldap_init (PASBackendLDAP *backend) { PASBackendLDAPPrivate *priv; - priv = g_new0 (PASBackendLDAPPrivate, 1); + priv = g_new0 (PASBackendLDAPPrivate, 1); + + priv->supported_fields = e_list_new ((EListCopyFunc)g_strdup, (EListFreeFunc)g_free, NULL); backend->priv = priv; } -- cgit v1.2.3