[evolution-data-server] Fix couple of invalid reads in idle_thread and namespace parsing



commit d60f5ea2fe871838c171aae7f4f5e5ff4026266c
Author: Chenthill Palanisamy <pchenthill novell com>
Date:   Fri Mar 5 11:15:57 2010 +0530

    Fix couple of invalid reads in idle_thread and namespace parsing

 camel/providers/imapx/camel-imapx-folder.c |   36 ++++-----------------------
 camel/providers/imapx/camel-imapx-server.c |   10 ++++---
 camel/providers/imapx/camel-imapx-utils.c  |    3 +-
 3 files changed, 13 insertions(+), 36 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-folder.c b/camel/providers/imapx/camel-imapx-folder.c
index 6d2b253..0d3b50d 100644
--- a/camel/providers/imapx/camel-imapx-folder.c
+++ b/camel/providers/imapx/camel-imapx-folder.c
@@ -105,30 +105,6 @@ camel_imapx_folder_new(CamelStore *store, const gchar *folder_dir, const gchar *
 	return folder;
 }
 
-#if 0
-/* experimental interfaces */
-void
-camel_imapx_folder_open(CamelIMAPXFolder *folder, CamelException *ex)
-{
-	/* */
-}
-
-void
-camel_imapx_folder_delete(CamelIMAPXFolder *folder, CamelException *ex)
-{
-}
-
-void
-camel_imapx_folder_rename(CamelIMAPXFolder *folder, const gchar *new, CamelException *ex)
-{
-}
-
-void
-camel_imapx_folder_close(CamelIMAPXFolder *folder, CamelException *ex)
-{
-}
-#endif
-
 static void
 imapx_refresh_info (CamelFolder *folder, CamelException *ex)
 {
@@ -396,7 +372,7 @@ imapx_search_by_expression (CamelFolder *folder, const gchar *expression, CamelE
 }
 
 static void
-imap_folder_class_init (CamelIMAPXFolderClass *klass)
+imapx_folder_class_init (CamelIMAPXFolderClass *klass)
 {
 	offline_folder_class = CAMEL_OFFLINE_FOLDER_CLASS (camel_type_get_global_classfuncs (camel_offline_folder_get_type ()));
 	
@@ -416,7 +392,7 @@ imap_folder_class_init (CamelIMAPXFolderClass *klass)
 }
 
 static void
-imap_folder_init(CamelObject *o, CamelObjectClass *klass)
+imapx_folder_init(CamelObject *o, CamelObjectClass *klass)
 {
 	CamelFolder *folder = (CamelFolder *)o;
 
@@ -431,7 +407,7 @@ imap_folder_init(CamelObject *o, CamelObjectClass *klass)
 }
 
 static void
-imap_finalize (CamelObject *object)
+imapx_finalize (CamelObject *object)
 {
 	CamelIMAPXFolder *ifolder = (CamelIMAPXFolder *) object;
 
@@ -452,10 +428,10 @@ camel_imapx_folder_get_type (void)
 		camel_imapx_folder_type = camel_type_register (parent_class, "CamelIMAPXFolder",
 							      sizeof (CamelIMAPXFolder),
 							      sizeof (CamelIMAPXFolderClass),
-							      (CamelObjectClassInitFunc)imap_folder_class_init,
+							      (CamelObjectClassInitFunc)imapx_folder_class_init,
 							      NULL,
-							      imap_folder_init,
-							      (CamelObjectFinalizeFunc) imap_finalize);
+							      imapx_folder_init,
+							      (CamelObjectFinalizeFunc) imapx_finalize);
 	}
 
 	return camel_imapx_folder_type;
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 4ae25e3..f3f06b2 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -1692,7 +1692,7 @@ imapx_register_job (CamelIMAPXServer *is, CamelIMAPXJob *job)
 static void
 imapx_run_job (CamelIMAPXServer *is, CamelIMAPXJob *job)
 {
-	CamelMsgPort *reply;
+	CamelMsgPort *reply = NULL;
 
 	if (!job->noreply) {
 		reply = camel_msgport_new ();
@@ -1804,9 +1804,8 @@ imapx_server_fetch_new_messages (CamelIMAPXServer *is, CamelFolder *folder, gboo
 	if (imapx_register_job (is, job))
 		imapx_run_job (is, job);
 	
-	if (job->op)
-		camel_operation_unref (job->op);
-	g_free (job);
+	if (!async)
+		g_free (job);
 }
 
 static gpointer
@@ -2923,6 +2922,9 @@ imapx_command_fetch_new_messages_done (CamelIMAPXServer *is, CamelIMAPXCommand *
 exception:
 	if (ic->job->noreply)
 		camel_folder_change_info_free(ic->job->u.refresh_info.changes);
+	
+	if (ic->job->op)
+		camel_operation_unref (ic->job->op);
 
 	imapx_job_done (is, ic->job);
 	camel_imapx_command_free (ic);
diff --git a/camel/providers/imapx/camel-imapx-utils.c b/camel/providers/imapx/camel-imapx-utils.c
index cc0c3d8..307819c 100644
--- a/camel/providers/imapx/camel-imapx-utils.c
+++ b/camel/providers/imapx/camel-imapx-utils.c
@@ -477,7 +477,6 @@ imapx_parse_namespace_list (CamelIMAPXStream *stream, CamelException *ex)
 				node->next = NULL;
 				node->full_name = g_strdup ((gchar *) token);
 				node->path = g_strdup ((gchar *) token);
-				g_message ("namespace: Node path is %s \n", node->path);
 
 				tok = camel_imapx_stream_token (stream, &token, &len, ex);
 
@@ -503,7 +502,7 @@ imapx_parse_namespace_list (CamelIMAPXStream *stream, CamelException *ex)
 				tail->next = node;
 				tail = node;
 
-				if (node->path [strlen (node->path) -1] == node->sep)
+				if (*node->path && node->path [strlen (node->path) -1] == node->sep)
 					node->path [strlen (node->path) - 1] = '\0';
 
 				if (!g_ascii_strncasecmp (node->path, "INBOX", 5) &&



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