diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-05-16 19:45:45 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-05-16 19:45:45 +0800 |
commit | 4ce48773980ec26cde77275c68fa05a5eab73515 (patch) | |
tree | 77e338dfe31f3bbb978f5cd7ddc94f2fc1a96e7b /addressbook/backend | |
parent | 006c78bdab12452630ecf0f7b97c8f0870fcca8c (diff) | |
download | gsoc2013-evolution-4ce48773980ec26cde77275c68fa05a5eab73515.tar.gz gsoc2013-evolution-4ce48773980ec26cde77275c68fa05a5eab73515.tar.zst gsoc2013-evolution-4ce48773980ec26cde77275c68fa05a5eab73515.zip |
Fixed some memory leaks.
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.
svn path=/trunk/; revision=3085
Diffstat (limited to 'addressbook/backend')
-rw-r--r-- | addressbook/backend/ebook/e-card-simple.c | 8 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-card.c | 115 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-backend-file.c | 4 |
3 files changed, 52 insertions, 75 deletions
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 |