Pile of Patches [2nd try]
- From: Morten Welinder <terra diku dk>
- To: balsa-list gnome org
- Subject: Pile of Patches [2nd try]
- Date: Mon, 26 Apr 1999 21:19:21 +0200 (METDST)
Someone ought to check these out and then check them in.
Morten
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/balsa/ChangeLog,v
retrieving revision 1.95
diff -u -r1.95 ChangeLog
--- ChangeLog 1999/04/09 04:00:42 1.95
+++ ChangeLog 1999/04/26 18:35:46
@@ -1,3 +1,31 @@
+Sun Apr 25 23:37:25 1999 Morten Welinder <terra@diku.dk>
+
+ * libbalsa/mailbox.c (message_free): Don't leak the addresses in
+ to_list, cc_list, and bcc_list. Don't leak bcc_list.
+ (mailbox_gather_content_info): Return a well-defined value.
+ (mailbox_open_unref): Don't leak the mailbox.
+
+ * src/balsa-index.c (balsa_index_add): Initialise text[0] ealier
+ so it is not accessed uninitialised.
+
+ * src/save-restore.c (config_global_load): Don't leak
+ all the fields.
+
+ * src/main-window.c (set_icon): Don't leak filename.
+
+ * src/local-mailbox.c (add_mailbox): Don't leak the directory name.
+
+ * src/balsa-init.c (create_mailbox_if_not_present): Don't leak
+ file handles.
+
+ * src/main-window.c (set_icon): Initialise att.event_mask.
+ Someone ought to check the sanity of the value.
+
+ * src/local-mailbox.c (add_mailbox): Don't strdup the name
+ argument to mailbox_node_new.
+
+ * libbalsa/misc.c (mailbox_node_new): Make name argument const.
+
1999-04-08 Jesse Sightler <jsight@pair.com>
* src/balsa-message.c: Added keyboard navigation.
Index: libbalsa/mailbox.c
===================================================================
RCS file: /cvs/gnome/balsa/libbalsa/mailbox.c,v
retrieving revision 1.88
diff -u -r1.88 mailbox.c
--- mailbox.c 1999/03/11 20:18:14 1.88
+++ mailbox.c 1999/04/26 18:35:46
@@ -469,7 +469,7 @@
mailbox->new_messages = CLIENT_CONTEXT (mailbox)->msgcount;
load_messages (mailbox, 0);
- /* incriment the reference count */
+ /* increment the reference count */
mailbox->open_ref++;
#ifdef DEBUG
@@ -515,7 +515,10 @@
don't ask me what to do - AC */
if (mx_close_mailbox (CLIENT_CONTEXT (mailbox)) == 0)
- CLIENT_CONTEXT (mailbox) = NULL;
+ {
+ free (CLIENT_CONTEXT (mailbox));
+ CLIENT_CONTEXT (mailbox) = NULL;
+ }
}
}
@@ -1107,8 +1110,8 @@
}
mailbox_open_unref (mailbox);
- return TRUE;
#endif
+ return TRUE;
}
@@ -1177,6 +1180,8 @@
void
message_free (Message * message)
{
+ GList* list;
+
g_free (message->remail);
g_free (message->date);
address_free (message->from);
@@ -1184,8 +1189,17 @@
address_free (message->reply_to);
g_free (message->subject);
+ for (list = g_list_first (message->to_list); list; list = g_list_next (list))
+ address_free (list->data);
g_list_free (message->to_list);
+
+ for (list = g_list_first (message->cc_list); list; list = g_list_next (list))
+ address_free (list->data);
g_list_free (message->cc_list);
+
+ for (list = g_list_first (message->bcc_list); list; list = g_list_next (list))
+ address_free (list->data);
+ g_list_free (message->bcc_list);
g_free (message->in_reply_to);
g_free (message->message_id);
Index: libbalsa/misc.c
===================================================================
RCS file: /cvs/gnome/balsa/libbalsa/misc.c,v
retrieving revision 1.25
diff -u -r1.25 misc.c
--- misc.c 1999/03/11 20:18:16 1.25
+++ misc.c 1999/04/26 18:35:46
@@ -33,7 +33,7 @@
#include "misc.h"
MailboxNode *
-mailbox_node_new (gchar * name, Mailbox * mb, gint i)
+mailbox_node_new (const gchar * name, Mailbox * mb, gint i)
{
MailboxNode *mbn;
mbn = g_malloc (sizeof (MailboxNode));
Index: libbalsa/misc.h
===================================================================
RCS file: /cvs/gnome/balsa/libbalsa/misc.h,v
retrieving revision 1.17
diff -u -r1.17 misc.h
--- misc.h 1999/03/11 20:18:17 1.17
+++ misc.h 1999/04/26 18:35:46
@@ -36,6 +36,6 @@
gint expanded;
};
-MailboxNode *mailbox_node_new (gchar * name, Mailbox * mb, gint i);
+MailboxNode *mailbox_node_new (const gchar * name, Mailbox * mb, gint i);
gchar *g_get_host_name (void);
#endif /* __MISC_H__ */
Index: src/balsa-index.c
===================================================================
RCS file: /cvs/gnome/balsa/src/balsa-index.c,v
retrieving revision 1.112
diff -u -r1.112 balsa-index.c
--- balsa-index.c 1999/02/21 15:28:10 1.112
+++ balsa-index.c 1999/04/26 18:35:46
@@ -389,6 +389,9 @@
text[2] = NULL; /* attachments */
text[3] = buff2;
+ /* set message number */
+ sprintf (text[0], "%d", row + 1);
+
if (message->from)
{
if (message->from->personal)
@@ -404,8 +407,6 @@
row = gtk_clist_append (GTK_CLIST (bindex), text);
- /* set message number */
- sprintf (text[0], "%d", row + 1);
gtk_clist_set_text (GTK_CLIST (bindex), row, 0, text[0]);
gtk_clist_set_row_data (GTK_CLIST (bindex), row, (gpointer) message);
Index: src/balsa-init.c
===================================================================
RCS file: /cvs/gnome/balsa/src/balsa-init.c,v
retrieving revision 1.54
diff -u -r1.54 balsa-init.c
--- balsa-init.c 1999/03/21 14:11:10 1.54
+++ balsa-init.c 1999/04/26 18:35:46
@@ -451,7 +451,15 @@
/* Make the as much of the path as required. */
if (make_parents (dir))
- creat (filename, S_IRUSR | S_IWUSR);
+ {
+ int fd = creat (filename, S_IRUSR | S_IWUSR);
+ if (fd == 1)
+ {
+ /* FIXME: Complain fiercely! */
+ }
+ else
+ close (fd);
+ }
g_free (dir);
} /* create_mailbox_if_not_present */
Index: src/local-mailbox.c
===================================================================
RCS file: /cvs/gnome/balsa/src/local-mailbox.c,v
retrieving revision 1.36
diff -u -r1.36 local-mailbox.c
--- local-mailbox.c 1999/02/21 15:28:20 1.36
+++ local-mailbox.c 1999/04/26 18:35:46
@@ -93,7 +93,7 @@
gchar *tmppath;
MailboxNode *mbnode;
- mbnode = mailbox_node_new (g_strdup (path), NULL, TRUE);
+ mbnode = mailbox_node_new (path, NULL, TRUE);
tmppath = g_strdup_printf ("%s/.expanded", path);
if (access (tmppath, F_OK) != -1)
@@ -119,7 +119,7 @@
if (isdir && type == MAILBOX_MH)
{
/* g_strdup (g_basename (g_dirname (myfile))) */
- node = g_node_new (mailbox_node_new (g_strdup (path), mailbox, TRUE));
+ node = g_node_new (mailbox_node_new (path, mailbox, TRUE));
rnode = find_my_node (balsa_app.mailbox_nodes, G_LEVEL_ORDER, G_TRAVERSE_ALL, g_dirname (path));
if (rnode)
{
@@ -134,8 +134,10 @@
}
else
{
- node = g_node_new (mailbox_node_new (g_strdup (path), mailbox, FALSE));
- rnode = find_my_node (balsa_app.mailbox_nodes, G_LEVEL_ORDER, G_TRAVERSE_ALL, g_dirname (path));
+ char *dirname = g_dirname (path);
+ node = g_node_new (mailbox_node_new (path, mailbox, FALSE));
+ rnode = find_my_node (balsa_app.mailbox_nodes, G_LEVEL_ORDER, G_TRAVERSE_ALL, dirname);
+ g_free (dirname);
if (rnode)
{
add_mailboxes_for_checking (mailbox);
Index: src/main-window.c
===================================================================
RCS file: /cvs/gnome/balsa/src/main-window.c,v
retrieving revision 1.195
diff -u -r1.195 main-window.c
--- main-window.c 1999/02/24 03:33:13 1.195
+++ main-window.c 1999/04/26 18:35:46
@@ -663,6 +663,7 @@
att.width = 32;
att.height = 24;
}
+ att.event_mask = GDK_ALL_EVENTS_MASK;
att.wclass = GDK_INPUT_OUTPUT;
att.window_type = GDK_WINDOW_TOPLEVEL;
att.x = 0;
@@ -670,7 +671,11 @@
att.visual = gdk_imlib_get_visual ();
att.colormap = gdk_imlib_get_colormap ();
ic_win = gdk_window_new (NULL, &att, GDK_WA_VISUAL | GDK_WA_COLORMAP);
- im = gdk_imlib_load_image (gnome_unconditional_pixmap_file ("balsa/balsa_icon.png"));
+ {
+ char *filename = gnome_unconditional_pixmap_file ("balsa/balsa_icon.png");
+ im = gdk_imlib_load_image (filename);
+ g_free (filename);
+ }
gdk_window_set_icon (w, ic_win, NULL, NULL);
gdk_imlib_render (im, att.width, att.height);
pmap = gdk_imlib_move_image (im);
Index: src/save-restore.c
===================================================================
RCS file: /cvs/gnome/balsa/src/save-restore.c,v
retrieving revision 1.88
diff -u -r1.88 save-restore.c
--- save-restore.c 1999/02/24 03:33:17 1.88
+++ save-restore.c 1999/04/26 18:35:46
@@ -595,14 +595,17 @@
/* user's real name */
if ((field = pl_dict_get_str (globals, "RealName")) == NULL)
return FALSE;
+ g_free (balsa_app.address->personal);
balsa_app.address->personal = g_strdup (field);
/* user's email address */
if ((field = pl_dict_get_str (globals, "Email")) == NULL)
return FALSE;
+ g_free (balsa_app.address->mailbox);
balsa_app.address->mailbox = g_strdup (field);
/* users's replyto address */
+ g_free (balsa_app.replyto);
if ((field = pl_dict_get_str (globals, "ReplyTo")) == NULL)
balsa_app.replyto = g_strdup (balsa_app.address->mailbox);
else
@@ -611,9 +614,11 @@
/* directory */
if ((field = pl_dict_get_str (globals, "LocalMailDir")) == NULL)
return FALSE;
+ g_free (balsa_app.local_mail_directory);
balsa_app.local_mail_directory = g_strdup (field);
/* signature file path */
+ g_free (balsa_app.signature_path);
if ((field = pl_dict_get_str (globals, "SignaturePath")) == NULL)
{
balsa_app.signature_path = g_malloc (strlen (g_get_home_dir ()) + 12);
@@ -625,6 +630,7 @@
/* smtp server */
if ((field = pl_dict_get_str (globals, "SMTPServer")) == NULL)
; /* an optional field for now */
+ g_free (balsa_app.smtp_server);
balsa_app.smtp_server = g_strdup (field);
/* toolbar style */
@@ -680,6 +686,7 @@
/* arp --- LeadinStr for "reply to" leadin. */
+ g_free (balsa_app.quote_str);
if ((field = pl_dict_get_str (globals, "LeadinStr")) == NULL)
balsa_app.quote_str = g_strdup ("> ");
else
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]