[evolution-patches] mail, #307398



Not a crash but we do accessed free'd memory, so i think this should go
into 2.2.x

Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3647
diff -u -p -r1.3647 ChangeLog
--- mail/ChangeLog	21 Jun 2005 05:33:47 -0000	1.3647
+++ mail/ChangeLog	24 Jun 2005 17:35:50 -0000
@@ -1,4 +1,12 @@
+2005-06-25  Not Zed  <NotZed Ximian com>
+
+	** See bug #307398
+
+	* mail-session.c (alert_user): copy the prompt string, in 'no
+	cancel' mode we run asynchronously.
+	(free_user_message): & free it.
+
 2005-06-21 Brian Mury <b mury ieee org>
 
 	** See bug #301466.
Index: mail/mail-session.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-session.c,v
retrieving revision 1.104
diff -u -p -r1.104 mail-session.c
--- mail/mail-session.c	16 May 2005 06:15:38 -0000	1.104
+++ mail/mail-session.c	24 Jun 2005 17:35:52 -0000
@@ -259,7 +259,7 @@ struct _user_message_msg {
 	struct _mail_msg msg;
 
 	CamelSessionAlertType type;
-	const char *prompt;
+	char *prompt;
 
 	unsigned int allow_cancel:1;
 	unsigned int result:1;
@@ -346,7 +346,15 @@ do_user_message (struct _mail_msg *mm)
 	}
 }
 
-static struct _mail_msg_op user_message_op = { NULL, do_user_message, NULL, NULL };
+static void
+free_user_message(struct _mail_msg *mm)
+{
+	struct _user_message_msg *m = (struct _user_message_msg *)mm;
+
+	g_free(m->prompt);
+}
+
+static struct _mail_msg_op user_message_op = { NULL, do_user_message, NULL, free_user_message };
 
 static gboolean
 alert_user(CamelSession *session, CamelSessionAlertType type, const char *prompt, gboolean cancel)
@@ -364,7 +372,7 @@ alert_user(CamelSession *session, CamelS
 	m = mail_msg_new (&user_message_op, user_message_reply, sizeof (*m));
 	m->ismain = pthread_self() == mail_gui_thread;
 	m->type = type;
-	m->prompt = prompt;
+	m->prompt = g_strdup(prompt);
 	m->allow_cancel = cancel;
 
 	if (m->ismain)


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