commit ea8a1410e7d77a4ad37739df3cc83e654858105b
parent 27646e8b7fb5c790b1810139361a11d8cc9010fa
Author: Colin Leroy <colin@colino.net>
Date: Wed, 9 Dec 2009 16:48:40 +0000
2009-12-09 [colin] 3.7.3cvs36
* src/compose.c
Fix leak and unchecked accesses.
Diffstat:
4 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,8 @@
+2009-12-09 [colin] 3.7.3cvs36
+
+ * src/compose.c
+ Fix leak and unchecked accesses.
+
2009-12-09 [mir] 3.7.3cvs35
* src/compose.c
diff --git a/PATCHSETS b/PATCHSETS
@@ -3909,3 +3909,4 @@
( cvs diff -u -r 1.94.2.206 -r 1.94.2.207 src/messageview.c; ) > 3.7.3cvs33.patchset
( cvs diff -u -r 1.382.2.531 -r 1.382.2.532 src/compose.c; ) > 3.7.3cvs34.patchset
( cvs diff -u -r 1.382.2.532 -r 1.382.2.533 src/compose.c; ) > 3.7.3cvs35.patchset
+( cvs diff -u -r 1.382.2.533 -r 1.382.2.534 src/compose.c; ) > 3.7.3cvs36.patchset
diff --git a/configure.ac b/configure.ac
@@ -12,7 +12,7 @@ MINOR_VERSION=7
MICRO_VERSION=3
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=35
+EXTRA_VERSION=36
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
diff --git a/src/compose.c b/src/compose.c
@@ -1178,20 +1178,24 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
/* Place cursor according to provided input (mfield) */
switch (mfield) {
case NO_FIELD_PRESENT:
- gtk_widget_grab_focus(compose->header_last->entry);
+ if (compose->header_last)
+ gtk_widget_grab_focus(compose->header_last->entry);
break;
case TO_FIELD_PRESENT:
buf = gtk_editable_get_chars(GTK_EDITABLE(compose->subject_entry), 0, -1);
- /*
- * buf will always contain an allocated string,
- * either empty or populated with some text
- */
- gtk_entry_set_text(GTK_ENTRY(compose->subject_entry), buf);
+ if (buf) {
+ gtk_entry_set_text(GTK_ENTRY(compose->subject_entry), buf);
+ g_free(buf);
+ }
gtk_widget_grab_focus(compose->subject_entry);
break;
case SUBJECT_FIELD_PRESENT:
textview = GTK_TEXT_VIEW(compose->text);
+ if (!textview)
+ break;
textbuf = gtk_text_view_get_buffer(textview);
+ if (!textbuf)
+ break;
mark = gtk_text_buffer_get_insert(textbuf);
gtk_text_buffer_get_iter_at_mark(textbuf, &iter, mark);
gtk_text_buffer_insert(textbuf, &iter, "", -1);
@@ -8244,6 +8248,8 @@ static void compose_destroy(Compose *compose)
slist_free_strings(compose->header_list);
g_slist_free(compose->header_list);
+ compose->header_list = compose->newsgroup_list = compose->to_list = NULL;
+
g_hash_table_destroy(compose->email_hashtable);
procmsg_msginfo_free(compose->targetinfo);