From ec4e338ba20b916244c9b6a6ef46b8c33c43103b Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 7 Apr 2009 12:13:37 +0000 Subject: [PATCH] ** Fix for bug #577002 2009-04-07 Milan Crha ** Fix for bug #577002 * camel-nntp-store.c: (connect_to_server), (nntp_connect_offline), (nntp_store_finalize): Do not leak ".ev-journal" file handles. svn path=/trunk/; revision=10200 --- camel/providers/nntp/ChangeLog | 7 +++++++ camel/providers/nntp/camel-nntp-store.c | 25 ++++++++++++++++++------- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/camel/providers/nntp/ChangeLog b/camel/providers/nntp/ChangeLog index ff9567c..cc8f552 100644 --- a/camel/providers/nntp/ChangeLog +++ b/camel/providers/nntp/ChangeLog @@ -1,3 +1,10 @@ +2009-04-07 Milan Crha + + ** Fix for bug #577002 + + * camel-nntp-store.c: (connect_to_server), (nntp_connect_offline), + (nntp_store_finalize): Do not leak ".ev-journal" file handles. + 2009-02-25 Milan Crha ** Fix for bug #572268 diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c index 2ab6234..9150a77 100644 --- a/camel/providers/nntp/camel-nntp-store.c +++ b/camel/providers/nntp/camel-nntp-store.c @@ -248,11 +248,13 @@ connect_to_server (CamelService *service, struct addrinfo *ai, int ssl_mode, Cam if (xover_setup(store, ex) == -1) goto fail; - - path = g_build_filename (store->storage_path, ".ev-journal", NULL); - disco_store->diary = camel_disco_diary_new (disco_store, path, ex); - g_free (path); - + + if (!disco_store->diary) { + path = g_build_filename (store->storage_path, ".ev-journal", NULL); + disco_store->diary = camel_disco_diary_new (disco_store, path, ex); + g_free (path); + } + retval = TRUE; g_free(store->current_folder); @@ -342,7 +344,10 @@ nntp_connect_offline (CamelService *service, CamelException *ex) camel_data_cache_set_expire_age (nntp_store->cache, 60*60*24*14); camel_data_cache_set_expire_access (nntp_store->cache, 60*60*24*5); } - + + if (disco_store->diary) + return TRUE; + path = g_build_filename (nntp_store->storage_path, ".ev-journal", NULL); disco_store->diary = camel_disco_diary_new (disco_store, path, ex); g_free (path); @@ -988,6 +993,7 @@ nntp_store_finalize (CamelObject *object) { /* call base finalize */ CamelNNTPStore *nntp_store = CAMEL_NNTP_STORE (object); + CamelDiscoStore *disco_store = (CamelDiscoStore *) nntp_store; struct _CamelNNTPStorePrivate *p = nntp_store->priv; struct _xover_header *xover, *xn; @@ -1017,7 +1023,12 @@ nntp_store_finalize (CamelObject *object) if (nntp_store->cache) camel_object_unref(nntp_store->cache); - + + if (disco_store->diary) { + camel_object_unref (disco_store->diary); + disco_store->diary = NULL; + } + g_free(p); } -- 2.7.4