aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorLarry Ewing <lewing@ximian.com>2003-06-14 14:05:37 +0800
committerLarry Ewing <lewing@src.gnome.org>2003-06-14 14:05:37 +0800
commita699b39082bddbf402f5156ddce9c072cb5ce7e6 (patch)
treef20d366eff5b91aba406ade29023d702f0363578 /addressbook
parent1761fff007b20c765181f7e89c1cb4fd84c699e3 (diff)
downloadgsoc2013-evolution-a699b39082bddbf402f5156ddce9c072cb5ce7e6.tar
gsoc2013-evolution-a699b39082bddbf402f5156ddce9c072cb5ce7e6.tar.gz
gsoc2013-evolution-a699b39082bddbf402f5156ddce9c072cb5ce7e6.tar.bz2
gsoc2013-evolution-a699b39082bddbf402f5156ddce9c072cb5ce7e6.tar.lz
gsoc2013-evolution-a699b39082bddbf402f5156ddce9c072cb5ce7e6.tar.xz
gsoc2013-evolution-a699b39082bddbf402f5156ddce9c072cb5ce7e6.tar.zst
gsoc2013-evolution-a699b39082bddbf402f5156ddce9c072cb5ce7e6.zip
Fix lots of leaks, update for correct use of g_object_get. Some cleanups.
2003-06-14 Larry Ewing <lewing@ximian.com> * gui/backend/ebook/e-card-simple.c: * gui/backend/ebook/e-card.c: * gui/backend/ebook/evolution-ldif-importer.c: * gui/backend/ebook/load-pine-addressbook.c: * gui/backend/ebook/test-card.c: * gui/backend/pas/pas-backend-card-sexp.c: * gui/backend/pas/pas-backend-ldap.c: Fix lots of leaks, update for correct use of g_object_get. Some cleanups. svn path=/trunk/; revision=21443
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog13
-rw-r--r--addressbook/backend/ebook/e-card-simple.c30
-rw-r--r--addressbook/backend/ebook/e-card.c12
-rw-r--r--addressbook/backend/ebook/evolution-ldif-importer.c6
-rw-r--r--addressbook/backend/ebook/load-pine-addressbook.c1
-rw-r--r--addressbook/backend/ebook/test-card.c3
-rw-r--r--addressbook/backend/pas/pas-backend-card-sexp.c4
-rw-r--r--addressbook/backend/pas/pas-backend-ldap.c3
8 files changed, 64 insertions, 8 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 0d365fa0c7..0797aecca0 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,5 +1,16 @@
-2003-06-13 Larry Ewing <lewing@ximian.com>
+2003-06-14 Larry Ewing <lewing@ximian.com>
+
+ * gui/backend/ebook/e-card-simple.c:
+ * gui/backend/ebook/e-card.c:
+ * gui/backend/ebook/evolution-ldif-importer.c:
+ * gui/backend/ebook/load-pine-addressbook.c:
+ * gui/backend/ebook/test-card.c:
+ * gui/backend/pas/pas-backend-card-sexp.c:
+ * gui/backend/pas/pas-backend-ldap.c: Fix lots of leaks, update
+ for correct use of g_object_get. Some cleanups.
+2003-06-13 Larry Ewing <lewing@ximian.com>
+
* gui/component/addressbook.c:
* gui/component/e-cardlist-model.c:
* gui/component/select-names/e-select-names-text-model.c:
diff --git a/addressbook/backend/ebook/e-card-simple.c b/addressbook/backend/ebook/e-card-simple.c
index db008011cd..b9e32762fe 100644
--- a/addressbook/backend/ebook/e-card-simple.c
+++ b/addressbook/backend/ebook/e-card-simple.c
@@ -556,6 +556,11 @@ fill_in_info(ECardSimple *simple)
}
}
g_object_unref(iterator);
+
+ g_object_unref(phone_list);
+ g_object_unref(email_list);
+ g_object_unref(address_list);
+ g_object_unref(delivery_list);
e_card_free_empty_lists (card);
}
}
@@ -719,6 +724,11 @@ e_card_simple_sync_card(ECardSimple *simple)
}
}
fill_in_info(simple);
+
+ g_object_unref(phone_list);
+ g_object_unref(email_list);
+ g_object_unref(address_list);
+ g_object_unref(delivery_list);
e_card_free_empty_lists (card);
}
@@ -803,7 +813,7 @@ char *e_card_simple_get (ECardSimple *simple,
ECardSimpleInternalType type = field_data[field].type;
const ECardAddrLabel *addr;
const ECardPhone *phone;
- const char *string;
+ char *string;
ECardDate *date;
ECardName *name;
switch(type) {
@@ -812,7 +822,7 @@ char *e_card_simple_get (ECardSimple *simple,
g_object_get(simple->card,
field_data[field].ecard_field, &string,
NULL);
- return g_strdup(string);
+ return string;
} else
return NULL;
case E_CARD_SIMPLE_INTERNAL_TYPE_DATE:
@@ -877,17 +887,26 @@ char *e_card_simple_get (ECardSimple *simple,
"file_as", &string,
NULL);
if (string && *string)
- return g_strdup(string);
+ return string
+; else
+ g_free (string);
+
g_object_get(simple->card,
"full_name", &string,
NULL);
if (string && *string)
return g_strdup(string);
+ else
+ g_free (string);
+
g_object_get(simple->card,
"org", &string,
NULL);
if (string && *string)
return g_strdup(string);
+ else
+ g_free (string);
+
is_list = e_card_evolution_list (simple->card);
if (is_list)
string = _("Unnamed List");
@@ -1199,6 +1218,8 @@ void e_card_simple_arbitrary_foreach (ECardSimple
if (callback)
(*callback) (arbitrary, closure);
}
+
+ g_object_unref (list);
e_card_free_empty_lists (simple->card);
}
}
@@ -1217,6 +1238,8 @@ const ECardArbitrary *e_card_simple_get_arbitrary (ECardSimple *sim
if (!strcasecmp(arbitrary->key, key))
return arbitrary;
}
+
+ g_object_unref (list);
e_card_free_empty_lists (simple->card);
}
return NULL;
@@ -1254,6 +1277,7 @@ void e_card_simple_set_arbitrary (ECardSimple *sim
new_arb->type = g_strdup(type);
new_arb->value = g_strdup(value);
e_list_append(list, new_arb);
+ g_object_unref(list);
e_card_arbitrary_unref(new_arb);
}
}
diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c
index 945888dad7..ff2ecc9287 100644
--- a/addressbook/backend/ebook/e-card.c
+++ b/addressbook/backend/ebook/e-card.c
@@ -839,6 +839,7 @@ parse_email(ECard *card, VObject *vobj, char *default_charset)
NULL);
e_list_append(list, next_email);
g_free (next_email);
+ g_object_unref(list);
}
/* Deal with charset */
@@ -869,6 +870,7 @@ parse_phone(ECard *card, VObject *vobj, char *default_charset)
NULL);
e_list_append(list, next_phone);
e_card_phone_unref (next_phone);
+ g_object_unref(list);
}
static void
@@ -891,6 +893,7 @@ parse_address(ECard *card, VObject *vobj, char *default_charset)
NULL);
e_list_append(list, next_addr);
e_card_delivery_address_unref (next_addr);
+ g_object_unref(list);
}
static void
@@ -907,6 +910,7 @@ parse_address_label(ECard *card, VObject *vobj, char *default_charset)
NULL);
e_list_append(list, next_addr);
e_card_address_label_unref (next_addr);
+ g_object_unref(list);
}
static void
@@ -1097,6 +1101,7 @@ do_parse_categories(ECard *card, char *str)
}
copy[j] = 0;
add_list_unique(card, list, copy);
+ g_object_unref(list);
g_free(copy);
}
@@ -1203,6 +1208,7 @@ parse_arbitrary(ECard *card, VObject *vobj, char *default_charset)
NULL);
e_list_append(list, arbitrary);
e_card_arbitrary_unref(arbitrary);
+ g_object_unref(list);
}
static void
@@ -1218,8 +1224,7 @@ parse_last_use(ECard *card, VObject *vobj, char *default_charset)
{
if ( vObjectValueType (vobj) ) {
char *str = fakeCString (vObjectUStringZValue (vobj));
- if ( card->last_use )
- g_free(card->last_use);
+ g_free(card->last_use);
card->last_use = g_new(ECardDate, 1);
*(card->last_use) = e_card_date_from_string(str);
free(str);
@@ -2044,6 +2049,7 @@ e_card_dispose (GObject *object)
FREE_IF(card->caluri);
FREE_IF(card->fburl);
FREE_IF(card->icscalendar);
+ FREE_IF(card->last_use);
FREE_IF(card->note);
FREE_IF(card->related_contacts);
@@ -2310,7 +2316,7 @@ e_card_get_property (GObject *object,
strs[i] = (char *)e_iterator_get(iterator);
}
strs[i] = 0;
- g_value_set_string(value, g_strjoinv(", ", strs));
+ g_value_set_string_take_ownership(value, g_strjoinv(", ", strs));
g_free(strs);
}
break;
diff --git a/addressbook/backend/ebook/evolution-ldif-importer.c b/addressbook/backend/ebook/evolution-ldif-importer.c
index a6ab49e215..559e591fdb 100644
--- a/addressbook/backend/ebook/evolution-ldif-importer.c
+++ b/addressbook/backend/ebook/evolution-ldif-importer.c
@@ -275,6 +275,7 @@ parseLine( ECardSimple *simple, ECardDeliveryAddress *address, char **buf )
"email", &email,
NULL);
e_list_append (email, ldif_value->str);
+ g_object_unref (email);
}
}
@@ -383,10 +384,12 @@ resolve_list_card (LDIFImporter *gci, ECard *card)
/* set file_as to full_name so we don't later try and figure
out a first/last name for the list. */
- if (full_name)
+ if (full_name) {
g_object_set (card,
"file_as", full_name,
NULL);
+ g_free (full_name);
+ }
email_iter = e_list_get_iterator (email);
while (e_iterator_is_valid (email_iter)) {
@@ -413,6 +416,7 @@ resolve_list_card (LDIFImporter *gci, ECard *card)
e_iterator_delete (email_iter);
}
}
+ g_object_unref(email);
}
static void
diff --git a/addressbook/backend/ebook/load-pine-addressbook.c b/addressbook/backend/ebook/load-pine-addressbook.c
index 5c98059a6b..ece04bbdef 100644
--- a/addressbook/backend/ebook/load-pine-addressbook.c
+++ b/addressbook/backend/ebook/load-pine-addressbook.c
@@ -42,6 +42,7 @@ parse_line (EBook *book, char *line)
NULL);
e_list_append(list, strings[2]);
e_book_add_card(book, card, add_card_cb, card);
+ g_object_unref(list);
}
g_strfreev(strings);
}
diff --git a/addressbook/backend/ebook/test-card.c b/addressbook/backend/ebook/test-card.c
index 62d9897c18..21806b0313 100644
--- a/addressbook/backend/ebook/test-card.c
+++ b/addressbook/backend/ebook/test-card.c
@@ -152,6 +152,7 @@ main (int argc, char **argv)
printf("Email : %s\n", (char *) e_iterator_get(iterator));
}
g_object_unref(iterator);
+ g_object_unref(email);
}
if ( phone ) {
iterator = e_list_get_iterator(address);
@@ -160,6 +161,7 @@ main (int argc, char **argv)
printf("Phone ; %d : %s\n", e_card_phone->flags, e_card_phone->number);
}
g_object_unref(iterator);
+ g_object_unref(phone);
}
if ( address ) {
iterator = e_list_get_iterator(address);
@@ -182,6 +184,7 @@ main (int argc, char **argv)
printf(" Country : %s\n", del_address->country);
}
g_object_unref(iterator);
+ g_object_unref(address);
}
printf("%s", e_card_get_vcard_assume_utf8(card));
g_object_unref (card);
diff --git a/addressbook/backend/pas/pas-backend-card-sexp.c b/addressbook/backend/pas/pas-backend-card-sexp.c
index 6c300d8e4f..e7b5d8a87d 100644
--- a/addressbook/backend/pas/pas-backend-card-sexp.c
+++ b/addressbook/backend/pas/pas-backend-card-sexp.c
@@ -122,6 +122,8 @@ compare_category (ECardSimple *card, const char *str,
g_object_unref (iterator);
e_card_free_empty_lists (ecard);
+ g_object_unref (categories);
+ g_object_unref (ecard);
return ret_val;
}
@@ -152,6 +154,8 @@ compare_arbitrary (ECardSimple *card, const char *str,
g_object_unref (iterator);
e_card_free_empty_lists (ecard);
+ g_object_unref (list);
+ g_object_unref (ecard);
return ret_val;
}
diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c
index aff94077ca..1e8677e559 100644
--- a/addressbook/backend/pas/pas-backend-ldap.c
+++ b/addressbook/backend/pas/pas-backend-ldap.c
@@ -2308,6 +2308,7 @@ category_populate (ECardSimple *card, char **values)
g_object_unref (categories);
e_card_simple_sync_card (card);
+ g_object_unref (ecard);
}
struct berval**
@@ -2342,6 +2343,8 @@ category_ber (ECardSimple *card)
g_object_unref (iterator);
}
+ g_object_unref (categories);
+ g_object_unref (ecard);
return result;
}