aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addressbook/ChangeLog9
-rw-r--r--addressbook/backend/ebook/e-card-simple.c8
-rw-r--r--addressbook/backend/ebook/e-card.c115
-rw-r--r--addressbook/backend/pas/pas-backend-file.c4
-rw-r--r--addressbook/contact-editor/e-contact-editor.c1
-rw-r--r--addressbook/ename/e-name-western.c2
-rw-r--r--addressbook/gui/component/addressbook.c8
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c1
-rw-r--r--addressbook/gui/minicard/e-minicard-view.c4
-rw-r--r--addressbook/gui/widgets/e-minicard-view.c4
-rw-r--r--e-util/ename/e-name-western.c2
11 files changed, 77 insertions, 81 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 76fc271026..197b7a747a 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,5 +1,14 @@
2000-05-16 Christopher James Lahey <clahey@helixcode.com>
+ * backend/ebook/e-card-simple.c, backend/pas/pas-backend-file.c,
+ contact-editor/e-contact-editor.c, ename/e-name-western.c,
+ gui/component/addressbook.c, gui/minicard/e-minicard-view.c: Fixed
+ some memory leaks.
+
+ * backend/ebook/e-card.c: Rearranged some code.
+
+2000-05-16 Christopher James Lahey <clahey@helixcode.com>
+
* contact-editor/e-contact-editor-categories.c: Fixed a reference
leak.
diff --git a/addressbook/backend/ebook/e-card-simple.c b/addressbook/backend/ebook/e-card-simple.c
index 6aac12742c..e087e153cb 100644
--- a/addressbook/backend/ebook/e-card-simple.c
+++ b/addressbook/backend/ebook/e-card-simple.c
@@ -368,6 +368,7 @@ static void
e_card_simple_destroy (GtkObject *object)
{
ECardSimple *simple;
+ int i;
simple = E_CARD_SIMPLE (object);
@@ -376,6 +377,13 @@ e_card_simple_destroy (GtkObject *object)
g_list_foreach(simple->temp_fields, (GFunc) g_free, NULL);
g_list_free(simple->temp_fields);
simple->temp_fields = NULL;
+
+ for(i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i++)
+ g_free(simple->phone[i]);
+ for(i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i++)
+ g_free(simple->email[i]);
+ for(i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++)
+ g_free(simple->address[i]);
}
diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c
index cff4e8d54f..851212ae22 100644
--- a/addressbook/backend/ebook/e-card.c
+++ b/addressbook/backend/ebook/e-card.c
@@ -699,16 +699,14 @@ parse_anniversary(ECard *card, VObject *vobj)
static void
parse_fburl(ECard *card, VObject *vobj)
{
- if (card->fburl)
- g_free(card->fburl);
+ g_free(card->fburl);
assign_string(vobj, &(card->fburl));
}
static void
parse_note(ECard *card, VObject *vobj)
{
- if (card->note)
- g_free(card->note);
+ g_free(card->note);
assign_string(vobj, &(card->note));
}
@@ -724,12 +722,13 @@ add_list_unique(ECard *card, ECardList *list, char *string)
}
for ( iterator = e_card_list_get_iterator(list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
if (!strcmp(e_card_iterator_get(iterator), temp)) {
- g_free(temp);
break;
}
}
if (!e_card_iterator_is_valid(iterator)) {
e_card_list_append(list, temp);
+ } else {
+ g_free(temp);
}
gtk_object_unref(GTK_OBJECT(iterator));
}
@@ -1142,44 +1141,27 @@ static void
e_card_destroy (GtkObject *object)
{
ECard *card = E_CARD(object);
- if ( card->id )
- g_free(card->id);
- if (card->file_as)
- g_free(card->file_as);
- if ( card->fname )
- g_free(card->fname);
+ g_free(card->id);
+ g_free(card->file_as);
+ g_free(card->fname);
if ( card->name )
e_card_name_free(card->name);
- if ( card->bday )
- g_free(card->bday);
-
- if (card->url)
- g_free(card->url);
- if (card->org)
- g_free(card->org);
- if (card->org_unit)
- g_free(card->org_unit);
- if (card->office)
- g_free(card->office);
- if (card->title)
- g_free(card->title);
- if (card->role)
- g_free(card->role);
- if (card->manager)
- g_free(card->manager);
- if (card->assistant)
- g_free(card->assistant);
- if (card->nickname)
- g_free(card->nickname);
- if (card->spouse)
- g_free(card->spouse);
- if (card->anniversary)
- g_free(card->anniversary);
- if (card->fburl)
- g_free(card->fburl);
- if (card->note)
- g_free(card->note);
-
+ g_free(card->bday);
+
+ g_free(card->url);
+ g_free(card->org);
+ g_free(card->org_unit);
+ g_free(card->office);
+ g_free(card->title);
+ g_free(card->role);
+ g_free(card->manager);
+ g_free(card->assistant);
+ g_free(card->nickname);
+ g_free(card->spouse);
+ g_free(card->anniversary);
+ g_free(card->fburl);
+ g_free(card->note);
+
if (card->categories)
gtk_object_unref(GTK_OBJECT(card->categories));
if (card->email)
@@ -1203,13 +1185,11 @@ e_card_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
switch (arg_id) {
case ARG_FILE_AS:
- if (card->file_as)
- g_free(card->file_as);
+ g_free(card->file_as);
card->file_as = g_strdup(GTK_VALUE_STRING(*arg));
break;
case ARG_FULL_NAME:
- if ( card->fname )
- g_free(card->fname);
+ g_free(card->fname);
card->fname = g_strdup(GTK_VALUE_STRING(*arg));
break;
case ARG_NAME:
@@ -1232,78 +1212,63 @@ e_card_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
gtk_object_ref(GTK_OBJECT(card->categories));
break;
case ARG_BIRTH_DATE:
- if ( card->bday )
- g_free(card->bday);
+ g_free(card->bday);
card->bday = GTK_VALUE_POINTER(*arg);
break;
case ARG_URL:
- if ( card->url )
- g_free(card->url);
+ g_free(card->url);
card->url = g_strdup(GTK_VALUE_STRING(*arg));
break;
case ARG_ORG:
- if (card->org)
- g_free(card->org);
+ g_free(card->org);
card->org = g_strdup(GTK_VALUE_STRING(*arg));
break;
case ARG_ORG_UNIT:
- if (card->org_unit)
- g_free(card->org_unit);
+ g_free(card->org_unit);
card->org_unit = g_strdup(GTK_VALUE_STRING(*arg));
break;
case ARG_OFFICE:
- if (card->office)
- g_free(card->office);
+ g_free(card->office);
card->office = g_strdup(GTK_VALUE_STRING(*arg));
break;
case ARG_TITLE:
- if ( card->title )
- g_free(card->title);
+ g_free(card->title);
card->title = g_strdup(GTK_VALUE_STRING(*arg));
break;
case ARG_ROLE:
- if (card->role)
- g_free(card->role);
+ g_free(card->role);
card->role = g_strdup(GTK_VALUE_STRING(*arg));
break;
case ARG_MANAGER:
- if (card->manager)
- g_free(card->manager);
+ g_free(card->manager);
card->manager = g_strdup(GTK_VALUE_STRING(*arg));
break;
case ARG_ASSISTANT:
- if (card->assistant)
- g_free(card->assistant);
+ g_free(card->assistant);
card->assistant = g_strdup(GTK_VALUE_STRING(*arg));
break;
case ARG_NICKNAME:
- if (card->nickname)
- g_free(card->nickname);
+ g_free(card->nickname);
card->nickname = g_strdup(GTK_VALUE_STRING(*arg));
break;
case ARG_SPOUSE:
- if (card->spouse)
- g_free(card->spouse);
+ g_free(card->spouse);
card->spouse = g_strdup(GTK_VALUE_STRING(*arg));
break;
case ARG_ANNIVERSARY:
- if ( card->anniversary )
- g_free(card->anniversary);
+ g_free(card->anniversary);
card->anniversary = GTK_VALUE_POINTER(*arg);
break;
case ARG_FBURL:
- if (card->fburl)
- g_free(card->fburl);
+ g_free(card->fburl);
card->fburl = g_strdup(GTK_VALUE_STRING(*arg));
break;
case ARG_NOTE:
- if (card->note)
- g_free (card->note);
+ g_free (card->note);
card->note = g_strdup(GTK_VALUE_STRING(*arg));
break;
case ARG_ID:
- if (card->id)
- g_free(card->id);
+ g_free(card->id);
card->id = g_strdup(GTK_VALUE_STRING(*arg));
break;
default:
diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c
index 1659eef062..9de1b1c421 100644
--- a/addressbook/backend/pas/pas-backend-file.c
+++ b/addressbook/backend/pas/pas-backend-file.c
@@ -666,6 +666,8 @@ pas_backend_file_process_modify_card (PASBackend *backend,
Evolution_BookListener_CardNotFound);
}
+ g_free(old_vcard_string);
+
gtk_object_unref(GTK_OBJECT(card));
g_free (req->vcard);
}
@@ -800,6 +802,8 @@ pas_backend_file_process_get_book_view (PASBackend *backend,
bf->priv->book_views = g_list_prepend(bf->priv->book_views, view);
pas_backend_file_search (bf, book, view);
+
+ g_free(req->search);
}
static void
diff --git a/addressbook/contact-editor/e-contact-editor.c b/addressbook/contact-editor/e-contact-editor.c
index e898b6eedd..058f39b153 100644
--- a/addressbook/contact-editor/e-contact-editor.c
+++ b/addressbook/contact-editor/e-contact-editor.c
@@ -1175,6 +1175,7 @@ fill_in_info(EContactEditor *editor)
gtk_editable_delete_text(editable, 0, -1);
if (categories)
gtk_editable_insert_text(editable, categories, strlen(categories), &position);
+ g_free(categories);
/* File as has to come after company and name or else it'll get messed up when setting them. */
position = 0;
diff --git a/addressbook/ename/e-name-western.c b/addressbook/ename/e-name-western.c
index 057afdacc1..698cceec0b 100644
--- a/addressbook/ename/e-name-western.c
+++ b/addressbook/ename/e-name-western.c
@@ -861,6 +861,8 @@ e_name_western_free (ENameWestern *w)
g_free (w->nick);
g_free (w->last);
g_free (w->suffix);
+
+ g_free (w->full);
g_free (w);
}
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index 5830eb95f8..f54738fcb9 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -94,13 +94,17 @@ static void
new_contact_cb (BonoboUIHandler *uih, void *user_data, const char *path)
{
gint result;
- GtkWidget* contact_editor =
- e_contact_editor_new(e_card_new(""));
+ ECard *card;
+ GtkWidget* contact_editor;
EBook *book;
AddressbookView *view = (AddressbookView *) user_data;
GtkObject *object;
GtkWidget* dlg = gnome_dialog_new ("Contact Editor", "Save", "Cancel", NULL);
+ card = e_card_new("");
+ contact_editor = e_contact_editor_new(card);
+ gtk_object_sink(GTK_OBJECT(card));
+
gtk_window_set_policy(GTK_WINDOW(dlg), FALSE, TRUE, FALSE);
if (view->view)
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index e898b6eedd..058f39b153 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -1175,6 +1175,7 @@ fill_in_info(EContactEditor *editor)
gtk_editable_delete_text(editable, 0, -1);
if (categories)
gtk_editable_insert_text(editable, categories, strlen(categories), &position);
+ g_free(categories);
/* File as has to come after company and name or else it'll get messed up when setting them. */
position = 0;
diff --git a/addressbook/gui/minicard/e-minicard-view.c b/addressbook/gui/minicard/e-minicard-view.c
index c77fc1f6ba..566b798987 100644
--- a/addressbook/gui/minicard/e-minicard-view.c
+++ b/addressbook/gui/minicard/e-minicard-view.c
@@ -210,8 +210,7 @@ e_minicard_view_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
}
break;
case ARG_QUERY:
- if (view->query)
- g_free(view->query);
+ g_free(view->query);
view->query = g_strdup(GTK_VALUE_STRING (*arg));
if (view->get_view_idle == 0)
view->get_view_idle = g_idle_add((GSourceFunc)get_view, view);
@@ -250,6 +249,7 @@ e_minicard_view_destroy (GtkObject *object)
gtk_signal_disconnect(GTK_OBJECT (GNOME_CANVAS_ITEM(view)->canvas),
view->canvas_destroy_id);
disconnect_signals(view);
+ g_free(view->query);
if (view->book)
gtk_object_unref(GTK_OBJECT(view->book));
if (view->book_view)
diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c
index c77fc1f6ba..566b798987 100644
--- a/addressbook/gui/widgets/e-minicard-view.c
+++ b/addressbook/gui/widgets/e-minicard-view.c
@@ -210,8 +210,7 @@ e_minicard_view_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
}
break;
case ARG_QUERY:
- if (view->query)
- g_free(view->query);
+ g_free(view->query);
view->query = g_strdup(GTK_VALUE_STRING (*arg));
if (view->get_view_idle == 0)
view->get_view_idle = g_idle_add((GSourceFunc)get_view, view);
@@ -250,6 +249,7 @@ e_minicard_view_destroy (GtkObject *object)
gtk_signal_disconnect(GTK_OBJECT (GNOME_CANVAS_ITEM(view)->canvas),
view->canvas_destroy_id);
disconnect_signals(view);
+ g_free(view->query);
if (view->book)
gtk_object_unref(GTK_OBJECT(view->book));
if (view->book_view)
diff --git a/e-util/ename/e-name-western.c b/e-util/ename/e-name-western.c
index 057afdacc1..698cceec0b 100644
--- a/e-util/ename/e-name-western.c
+++ b/e-util/ename/e-name-western.c
@@ -861,6 +861,8 @@ e_name_western_free (ENameWestern *w)
g_free (w->nick);
g_free (w->last);
g_free (w->suffix);
+
+ g_free (w->full);
g_free (w);
}