[evolution-data-server] Fix for bug #578817



commit fa2c26afe286da06ea773716e9b80f498acf59e0
Author: Sergio Villar Senín <svillar igalia com>
Date:   Fri Apr 24 11:44:44 2009 +0200

    Fix for bug #578817
---
 camel/ChangeLog     |   14 ++++++++++++
 camel/camel-store.c |   58 ++++++++++++++++++++++++++------------------------
 2 files changed, 44 insertions(+), 28 deletions(-)

diff --git a/camel/ChangeLog b/camel/ChangeLog
index a341253..5c06dde 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,17 @@
+2009-04-22  Sergio Villar Senin  <svillar igalia com>
+	
+	** Fix for bug #578817 - fixed potential invalid dereference
+	
+	* camel-store.c (camel_store_rename_folder):  added a condition
+	that avoids a potential invalid dereference of folders structure
+
+2009-04-15  Sergio Villar Senin  <svillar igalia com>
+
+	** Fix for bug #578821 - fixed potential invalid dereference
+	
+	* camel-vee-folder.c (subfolder_renamed_update): added a condition
+	that avoids a potential invalid dereference of vinfo structure
+
 2009-04-15  Sergio Villar Senin  <svillar igalia com>
 
 	** Fix for bug #578823 â?? invalid condition
diff --git a/camel/camel-store.c b/camel/camel-store.c
index 17a5965..cf9e7e6 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -577,40 +577,42 @@ camel_store_rename_folder (CamelStore *store, const char *old_namein, const char
 	CS_CLASS (store)->rename_folder (store, old_name, new_name, ex);
 
 	/* If it worked, update all open folders/unlock them */
-	if (folders && !camel_exception_is_set(ex)) {
-		guint32 flags = CAMEL_STORE_FOLDER_INFO_RECURSIVE;
-		CamelRenameInfo reninfo;
+	if (folders) {
+		if (!camel_exception_is_set(ex)) {
+			guint32 flags = CAMEL_STORE_FOLDER_INFO_RECURSIVE;
+			CamelRenameInfo reninfo;
 
-		for (i=0;i<folders->len;i++) {
-			char *new;
+			for (i=0;i<folders->len;i++) {
+				char *new;
 
-			folder = folders->pdata[i];
+				folder = folders->pdata[i];
 
-			new = g_strdup_printf("%s%s", new_name, folder->full_name+strlen(old_name));
-			camel_object_bag_rekey(store->folders, folder, new);
-			camel_folder_rename(folder, new);
-			g_free(new);
+				new = g_strdup_printf("%s%s", new_name, folder->full_name+strlen(old_name));
+				camel_object_bag_rekey(store->folders, folder, new);
+				camel_folder_rename(folder, new);
+				g_free(new);
 
-			CAMEL_FOLDER_REC_UNLOCK(folder, lock);
-			camel_object_unref(folder);
-		}
+				CAMEL_FOLDER_REC_UNLOCK(folder, lock);
+				camel_object_unref(folder);
+			}
 
-		/* Emit renamed signal */
-		if (store->flags & CAMEL_STORE_SUBSCRIPTIONS)
-			flags |= CAMEL_STORE_FOLDER_INFO_SUBSCRIBED;
+			/* Emit renamed signal */
+			if (store->flags & CAMEL_STORE_SUBSCRIPTIONS)
+				flags |= CAMEL_STORE_FOLDER_INFO_SUBSCRIBED;
 		
-		reninfo.old_base = (char *)old_name;
-		reninfo.new = ((CamelStoreClass *)((CamelObject *)store)->klass)->get_folder_info(store, new_name, flags, ex);
-		if (reninfo.new != NULL) {
-			camel_object_trigger_event (store, "folder_renamed", &reninfo);
-			((CamelStoreClass *)((CamelObject *)store)->klass)->free_folder_info(store, reninfo.new);
-		}
-	} else {
-		/* Failed, just unlock our folders for re-use */
-		for (i=0;i<folders->len;i++) {
-			folder = folders->pdata[i];
-			CAMEL_FOLDER_REC_UNLOCK(folder, lock);
-			camel_object_unref(folder);
+			reninfo.old_base = (char *)old_name;
+			reninfo.new = ((CamelStoreClass *)((CamelObject *)store)->klass)->get_folder_info(store, new_name, flags, ex);
+			if (reninfo.new != NULL) {
+				camel_object_trigger_event (store, "folder_renamed", &reninfo);
+				((CamelStoreClass *)((CamelObject *)store)->klass)->free_folder_info(store, reninfo.new);
+			}
+		} else {
+			/* Failed, just unlock our folders for re-use */
+			for (i=0;i<folders->len;i++) {
+				folder = folders->pdata[i];
+				CAMEL_FOLDER_REC_UNLOCK(folder, lock);
+				camel_object_unref(folder);
+			}
 		}
 	}
 



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