Plug to some memory/refcount leaks
- From: "Øystein Gisnås" <oystein gisnas net>
- To: tinymail-devel-list gnome org
- Subject: Plug to some memory/refcount leaks
- Date: Mon, 18 Dec 2006 23:43:01 +0100
I've fixed some missing and wrong refcount cases in the attached patch.
Øystein
Index: tests/functional/folder-lister-async.c
===================================================================
--- tests/functional/folder-lister-async.c (revisjon 1319)
+++ tests/functional/folder-lister-async.c (arbeidskopi)
@@ -123,6 +123,7 @@
tny_account_store_get_accounts (account_store, accounts,
TNY_ACCOUNT_STORE_STORE_ACCOUNTS);
+ g_object_unref (G_OBJECT (account_store));
iter = tny_list_create_iterator (accounts);
account = (TnyStoreAccount*) tny_iterator_get_current (iter);
Index: tests/functional/folder-lister.c
===================================================================
--- tests/functional/folder-lister.c (revisjon 1319)
+++ tests/functional/folder-lister.c (arbeidskopi)
@@ -105,6 +105,7 @@
tny_account_store_get_accounts (account_store, accounts,
TNY_ACCOUNT_STORE_STORE_ACCOUNTS);
+ g_object_unref (G_OBJECT (account_store));
iter = tny_list_create_iterator (accounts);
account = (TnyStoreAccount*) tny_iterator_get_current (iter);
Index: tests/functional/msg-transfer.c
===================================================================
--- tests/functional/msg-transfer.c (revisjon 1319)
+++ tests/functional/msg-transfer.c (arbeidskopi)
@@ -127,6 +127,7 @@
tny_account_store_get_accounts (account_store, accounts,
TNY_ACCOUNT_STORE_STORE_ACCOUNTS);
+ g_object_unref (G_OBJECT (account_store));
iter = tny_list_create_iterator (accounts);
account = (TnyStoreAccount*) tny_iterator_get_current (iter);
@@ -173,6 +174,8 @@
g_object_unref (G_OBJECT (src_headers));
cleanup:
+ g_object_unref (folder_src);
+ g_object_unref (folder_dst);
g_object_unref (account);
g_object_unref (query);
Index: tests/memory/memory-test.c
===================================================================
--- tests/memory/memory-test.c (revisjon 1319)
+++ tests/memory/memory-test.c (arbeidskopi)
@@ -156,6 +156,7 @@
tny_account_store_get_accounts (account_store, accounts,
TNY_ACCOUNT_STORE_STORE_ACCOUNTS);
+ g_object_unref (G_OBJECT (account_store));
aiter = tny_list_create_iterator (accounts);
tny_iterator_first (aiter);
Index: tests/shared/account-store.c
===================================================================
--- tests/shared/account-store.c (revisjon 1319)
+++ tests/shared/account-store.c (arbeidskopi)
@@ -156,6 +156,7 @@
TnyPlatformFactory *platfact = tny_test_platform_factory_get_instance ();
self->device = tny_platform_factory_new_device (platfact);
+ g_object_unref (G_OBJECT (platfact));
return;
}
@@ -166,6 +167,7 @@
{
TnyTestAccountStore *me = (TnyTestAccountStore*) object;
+ g_object_unref (G_OBJECT (me->device));
if (me->cache_dir)
g_free (me->cache_dir);
Index: libtinymail-camel/tny-camel-common.c
===================================================================
--- libtinymail-camel/tny-camel-common.c (revisjon 1319)
+++ libtinymail-camel/tny-camel-common.c (arbeidskopi)
@@ -29,42 +29,46 @@
{
gboolean retval = FALSE;
- if (query && (tny_list_get_length (tny_folder_store_query_get_items (query)) > 0))
+ if (!query)
+ return TRUE;
+
+ TnyList *items = tny_folder_store_query_get_items (query);
+ if (tny_list_get_length (items) <= 0)
{
- TnyList *items = tny_folder_store_query_get_items (query);
- TnyIterator *iterator;
- iterator = tny_list_create_iterator (items);
+ g_object_unref (G_OBJECT (items));
+ return TRUE;
+ }
+ TnyIterator *iterator;
+ iterator = tny_list_create_iterator (items);
- while (!tny_iterator_is_done (iterator))
- {
- TnyFolderStoreQueryItem *item = (TnyFolderStoreQueryItem*) tny_iterator_get_current (iterator);
- TnyFolderStoreQueryOption options = tny_folder_store_query_item_get_options (item);
- regex_t *regex = tny_folder_store_query_item_get_regex (item);
+ while (!tny_iterator_is_done (iterator))
+ {
+ TnyFolderStoreQueryItem *item = (TnyFolderStoreQueryItem*) tny_iterator_get_current (iterator);
+ TnyFolderStoreQueryOption options = tny_folder_store_query_item_get_options (item);
+ regex_t *regex = tny_folder_store_query_item_get_regex (item);
- if ((options & TNY_FOLDER_STORE_QUERY_OPTION_SUBSCRIBED) &&
- finfo->flags & CAMEL_FOLDER_SUBSCRIBED)
- retval = TRUE;
+ if ((options & TNY_FOLDER_STORE_QUERY_OPTION_SUBSCRIBED) &&
+ finfo->flags & CAMEL_FOLDER_SUBSCRIBED)
+ retval = TRUE;
- if ((options & TNY_FOLDER_STORE_QUERY_OPTION_UNSUBSCRIBED) &&
- !(finfo->flags & CAMEL_FOLDER_SUBSCRIBED))
- retval = TRUE;
+ if ((options & TNY_FOLDER_STORE_QUERY_OPTION_UNSUBSCRIBED) &&
+ !(finfo->flags & CAMEL_FOLDER_SUBSCRIBED))
+ retval = TRUE;
- if (regex && options & TNY_FOLDER_STORE_QUERY_OPTION_MATCH_ON_NAME)
- if (regexec (regex, finfo->name, 0, NULL, 0) == 0)
+ if (regex && options & TNY_FOLDER_STORE_QUERY_OPTION_MATCH_ON_NAME)
+ if (regexec (regex, finfo->name, 0, NULL, 0) == 0)
retval = TRUE;
- if (regex && options & TNY_FOLDER_STORE_QUERY_OPTION_MATCH_ON_ID)
- if (regexec (regex, finfo->full_name, 0, NULL, 0) == 0)
+ if (regex && options & TNY_FOLDER_STORE_QUERY_OPTION_MATCH_ON_ID)
+ if (regexec (regex, finfo->full_name, 0, NULL, 0) == 0)
retval = TRUE;
- g_object_unref (G_OBJECT (item));
- tny_iterator_next (iterator);
- }
-
- g_object_unref (G_OBJECT (iterator));
- g_object_unref (G_OBJECT (items));
- } else
- retval = TRUE;
+ g_object_unref (G_OBJECT (item));
+ tny_iterator_next (iterator);
+ }
+
+ g_object_unref (G_OBJECT (iterator));
+ g_object_unref (G_OBJECT (items));
return retval;
}
Index: libtinymail-camel/tny-camel-folder.c
===================================================================
--- libtinymail-camel/tny-camel-folder.c (revisjon 1319)
+++ libtinymail-camel/tny-camel-folder.c (arbeidskopi)
@@ -1533,6 +1533,7 @@
g_object_unref (G_OBJECT (header));
tny_iterator_next (iter);
}
+ g_object_unref (G_OBJECT (iter));
ex = camel_exception_new ();
camel_exception_init (ex);
@@ -1956,6 +1957,8 @@
tny_camel_folder_set_folder_info (self, folder, iter);
tny_list_prepend (list, G_OBJECT (folder));
+
+ g_object_unref (G_OBJECT (folder));
}
iter = iter->next;
}
Index: libtinymail-camel/tny-camel-store-account.c
===================================================================
--- libtinymail-camel/tny-camel-store-account.c (revisjon 1319)
+++ libtinymail-camel/tny-camel-store-account.c (arbeidskopi)
@@ -519,6 +519,7 @@
_tny_camel_folder_set_account (folder, TNY_ACCOUNT (self));
tny_list_prepend (list, G_OBJECT (folder));
+ g_object_unref (G_OBJECT (folder));
}
iter = iter->next;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]