commit e2f46985724eb6d10f8c6b5d9b3225560d12a192
Author: Johnny Jacob <jjohnny@novell.com>
Date:   Tue Jan 22 11:29:50 2008 +0530

    Fix for bug #503327

diff --git a/composer/ChangeLog b/composer/ChangeLog
index 07a13f0..17722b7 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,8 @@
+2008-01-21  Johnny Jacob  <jjohnny@novell.com>
+
+	* e-msg-composer.c (e_msg_composer_get_raw_message_text): Return
+	GByteArray instead of gchar*
+
 2008-01-14  Suman Manjunath  <msuman@novell.com>
 
 	** Fix for bug #502783
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index fccbf60..af09a37 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -6255,7 +6255,7 @@ e_msg_composer_unset_autosaved (EMsgComposer *composer)
  *
  * Returns the text/plain of the message from composer
  **/
-const gchar *
+GByteArray *
 e_msg_composer_get_raw_message_text (EMsgComposer *composer)
 {
        GByteArray *data = NULL;
@@ -6264,7 +6264,7 @@ e_msg_composer_get_raw_message_text (EMsgComposer *composer)
 
        data = get_text (p->persist_stream_interface, "text/plain");
        if (data)
-		return (const gchar *)data->data;
+		return data;
 
        return NULL;
 }
diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h
index 19e8417..a6c8e71 100644
--- a/composer/e-msg-composer.h
+++ b/composer/e-msg-composer.h
@@ -192,7 +192,7 @@ EMsgComposerHdrs*	 e_msg_composer_get_hdrs			 (EMsgComposer *composer);
 void			 e_msg_composer_set_saved			 (EMsgComposer *composer);
 void			 e_msg_composer_set_send_options		 (EMsgComposer *composer,
 									  gboolean      send_enable);
-const gchar *            e_msg_composer_get_raw_message_text              (EMsgComposer *composer);
+GByteArray *            e_msg_composer_get_raw_message_text              (EMsgComposer *composer);
 
 struct _EAttachmentBar*          e_msg_composer_get_attachment_bar                (EMsgComposer *composer);
 
diff --git a/plugins/attachment-reminder/ChangeLog b/plugins/attachment-reminder/ChangeLog
index 8f56be9..0d7f2de 100644
--- a/plugins/attachment-reminder/ChangeLog
+++ b/plugins/attachment-reminder/ChangeLog
@@ -1,3 +1,9 @@
+2008-01-22  Johnny Jacob  <jjohnny@novell.com>
+
+	* attachment-reminder.c (strip_text_msg): Memory leak Fix.
+	(org_gnome_evolution_attachment_reminder): Free	GByteArray.
+	NULL terminate string.
+	
 2008-01-14  Kjartan Maraas  <kmaraas@gnome.org>
 
 	* apps-evolution-attachment-reminder.schemas.in: Add
diff --git a/plugins/attachment-reminder/attachment-reminder.c b/plugins/attachment-reminder/attachment-reminder.c
index 6bbf4d0..b50fc5b 100644
--- a/plugins/attachment-reminder/attachment-reminder.c
+++ b/plugins/attachment-reminder/attachment-reminder.c
@@ -94,7 +94,9 @@ void
 org_gnome_evolution_attachment_reminder (EPlugin *ep, EMEventTargetComposer *t)
 {
 	GConfClient *gconf;
-	char *rawstr = NULL, *filtered_str = NULL;
+	GByteArray *raw_msg_barray;
+
+	gchar *filtered_str = NULL;
 
 	gconf = gconf_client_get_default ();
 	if (!gconf_client_get_bool (gconf, GCONF_KEY_ATTACHMENT_REMINDER, NULL)){
@@ -103,11 +105,15 @@ org_gnome_evolution_attachment_reminder (EPlugin *ep, EMEventTargetComposer *t)
 	} else
 		g_object_unref (gconf);
 
-	rawstr = g_strdup (e_msg_composer_get_raw_message_text (t->composer));
+	raw_msg_barray = e_msg_composer_get_raw_message_text (t->composer);
+
+	if (!raw_msg_barray)
+		return;
 
-	filtered_str = strip_text_msg (rawstr);
+	raw_msg_barray = g_byte_array_append (raw_msg_barray, (const guint8 *)"", 1);
 
-	g_free (rawstr);
+	filtered_str = strip_text_msg (raw_msg_barray->data);
+	g_byte_array_free (raw_msg_barray, TRUE);
 
 	/* Set presend_check_status for the composer*/
 	if (check_for_attachment_clues (filtered_str) && !check_for_attachment (t->composer))
@@ -136,6 +142,7 @@ check_for_attachment_clues (gchar *msg)
 
 	gconf = gconf_client_get_default ();
 
+
 	/* Get the list from gconf */
 	clue_list = gconf_client_get_list ( gconf, GCONF_KEY_ATTACH_REMINDER_CLUES, GCONF_VALUE_STRING, NULL );
 
@@ -176,12 +183,13 @@ strip_text_msg (gchar *msg)
 {
 	gchar **lines = g_strsplit ( msg, "\n", -1);
 	gchar *stripped_msg = g_strdup (" ");
-
 	guint i=0;
+	gchar *temp;
 
 	while (lines [i]){
 		if (lines [i] != NULL && !g_str_has_prefix (g_strstrip(lines[i]), ">")){
-			gchar *temp = stripped_msg;
+			temp = stripped_msg;
+
 			stripped_msg = g_strconcat (" ", stripped_msg, lines[i], NULL);
 
 			g_free (temp);
@@ -191,7 +199,10 @@ strip_text_msg (gchar *msg)
 
 	g_strfreev (lines);
 
-	return g_utf8_strdown (stripped_msg, -1);
+	temp = g_utf8_strdown (stripped_msg, -1);
+	g_free (stripped_msg);
+
+	return temp;
 }
 
 static void
