Re: [evolution-patches] Bug 45210 - LDAP PostalAddress compliance patch for evolution-data-server, contacts
- From: Chris Toshok <toshok ximian com>
- To: evolution-patches lists ximian com
- Subject: Re: [evolution-patches] Bug 45210 - LDAP PostalAddress compliance patch for evolution-data-server, contacts
- Date: Mon, 03 May 2004 10:39:32 -0700
On Sun, 2004-05-02 at 13:37 -0500, Edward Rudd wrote:
> Here is an updated version of my patch to fix the storage postalAddress
> fields in LDAP. This is based off of evolution-data-server CVS HEAD.
+struct berval **
+address_ber(EContact * card, EContactField field)
+{
+ struct berval **result = NULL;
+ const char *address;
+ char *temp, *i;
+
+ address = e_contact_get(card, field);
+ if (address) {
+ temp = g_strdup(address);
+ for (i = temp; *i != '\0'; i++) {
+ if (*i == '\n') {
+ *i = '$';
+ }
+ }
+
+ result = g_new(struct berval *, 2);
+ result[0] = g_new(struct berval, 1);
+ result[0]->bv_val = temp;
+ result[0]->bv_len = strlen(temp);
+
+ result[1] = NULL;
+ }
+ return result;
+}
So this will leak the label - the memory you get back from e_contact_get
is to be freed anyway, so just removing temp and using address in its
place should fix things.
Other than that, this looks fine.
Chris
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]