evolution-data-server r10200 - trunk/camel/providers/nntp



Author: mcrha
Date: Tue Apr  7 12:13:37 2009
New Revision: 10200
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=10200&view=rev

Log:
2009-04-07  Milan Crha  <mcrha redhat com>

	** Fix for bug #577002

	* camel-nntp-store.c: (connect_to_server), (nntp_connect_offline),
	(nntp_store_finalize): Do not leak ".ev-journal" file handles.



Modified:
   trunk/camel/providers/nntp/ChangeLog
   trunk/camel/providers/nntp/camel-nntp-store.c

Modified: trunk/camel/providers/nntp/camel-nntp-store.c
==============================================================================
--- trunk/camel/providers/nntp/camel-nntp-store.c	(original)
+++ trunk/camel/providers/nntp/camel-nntp-store.c	Tue Apr  7 12:13:37 2009
@@ -248,11 +248,13 @@
 
 	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 @@
 		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 @@
 {
 	/* 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 @@
 
 	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);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]