[Commits] [SCM] claws branch, master, updated. 3.13.2-3-gbfb1815
ticho at claws-mail.org
ticho at claws-mail.org
Sat Jan 23 16:51:01 CET 2016
The branch, master has been updated
via bfb18150efae6fc3eb1c7f436e1ffc86c8e375fa (commit)
from d4fa90e495fe3c6c6d04391c0beb1f7745bb3741 (commit)
Summary of changes:
src/action.c | 2 +-
src/compose.c | 32 ++++++------
src/folder.c | 34 ++++++-------
src/folderutils.c | 4 +-
src/imap.c | 20 ++++----
src/inc.c | 2 +-
src/mainwindow.c | 6 +--
src/mbox.c | 4 +-
src/messageview.c | 18 +++----
src/mh.c | 2 +-
src/msgcache.c | 12 ++---
src/partial_download.c | 2 +-
src/plugins/att_remover/att_remover.c | 12 ++---
src/plugins/vcalendar/common-views.c | 2 +-
src/plugins/vcalendar/vcal_folder.c | 6 +--
src/plugins/vcalendar/vcalendar.c | 2 +-
src/procmime.c | 2 +-
src/procmsg.c | 88 +++++++++++++++++----------------
src/procmsg.h | 2 +-
src/send_message.c | 2 +-
src/summaryview.c | 22 ++++-----
21 files changed, 140 insertions(+), 136 deletions(-)
- Log -----------------------------------------------------------------
commit bfb18150efae6fc3eb1c7f436e1ffc86c8e375fa
Author: Andrej Kacian <ticho at claws-mail.org>
Date: Sat Jan 23 15:40:38 2016 +0100
Make procmsg_msginfo_free() zero out pointers to freed memory.
The function's argument type changes from MsgInfo* to MsgInfo**,
so that we can zero out the pointer.
This closes bug #3598, reported by Hanno Boeck.
diff --git a/src/action.c b/src/action.c
index 86fd198..e78bf47 100644
--- a/src/action.c
+++ b/src/action.c
@@ -1445,7 +1445,7 @@ static void catch_status(GPid pid, gint status, gpointer data)
modified_something = TRUE;
last_item = nmi->folder;
}
- procmsg_msginfo_free (nmi);
+ procmsg_msginfo_free (&nmi);
if (summaryview && summaryview->displayed &&
summaryview->folder_item == msginfo->folder &&
summary_get_msgnum(summaryview, summaryview->displayed) == msginfo->msgnum)
diff --git a/src/compose.c b/src/compose.c
index 81947e7..af64a83 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -1205,7 +1205,7 @@ Compose *compose_generic_new(PrefsAccount *account, const gchar *mailto, FolderI
}
}
- procmsg_msginfo_free( dummyinfo );
+ procmsg_msginfo_free( &dummyinfo );
if (attach_files) {
GList *curr;
@@ -1826,7 +1826,7 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
quote_fmt_reset_vartable();
g_free(tmp);
- procmsg_msginfo_free(full_msginfo);
+ procmsg_msginfo_free(&full_msginfo);
}
textview = GTK_TEXT_VIEW(compose->text);
@@ -1885,7 +1885,7 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
quote_fmt_reset_vartable();
compose_attach_parts(compose, msginfo);
- procmsg_msginfo_free(full_msginfo);
+ procmsg_msginfo_free(&full_msginfo);
}
SIGNAL_BLOCK(textbuf);
@@ -3189,7 +3189,7 @@ error:
ok:
SIGNAL_UNBLOCK(buffer);
- procmsg_msginfo_free( dummyinfo );
+ procmsg_msginfo_free( &dummyinfo );
return buf;
}
@@ -3778,7 +3778,7 @@ static gboolean compose_attach_append(Compose *compose, const gchar *file,
ainfo->name = g_strdup_printf(_("Message: %s"), name);
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
} else {
if (!g_ascii_strncasecmp(content_type, "text/", 5)) {
ainfo->charset = g_strdup(charset);
@@ -5214,7 +5214,7 @@ gint compose_send(Compose *compose)
if (tmp) {
debug_print("removing %d via %s\n", tmp->msgnum, tmsgid);
folder_item_remove_msg(folder, tmp->msgnum);
- procmsg_msginfo_free(tmp);
+ procmsg_msginfo_free(&tmp);
}
}
}
@@ -5230,7 +5230,7 @@ gint compose_send(Compose *compose)
if (tmp) {
debug_print("removing %d via %s\n", tmp->msgnum, tmsgid);
folder_item_remove_msg(folder, tmp->msgnum);
- procmsg_msginfo_free(tmp);
+ procmsg_msginfo_free(&tmp);
}
}
if (!discard_window) {
@@ -8615,7 +8615,7 @@ static void compose_template_apply(Compose *compose, Template *tmpl,
parsed_str = compose_quote_fmt(compose, dummyinfo,
tmpl->value, qmark, tmp, FALSE, FALSE, err_msg);
- procmsg_msginfo_free( dummyinfo );
+ procmsg_msginfo_free( &dummyinfo );
g_free( tmp );
}
@@ -8781,7 +8781,7 @@ static void compose_template_apply_fields(Compose *compose, Template *tmpl)
}
}
- procmsg_msginfo_free( dummyinfo );
+ procmsg_msginfo_free( &dummyinfo );
}
static void compose_destroy(Compose *compose)
@@ -8816,9 +8816,9 @@ static void compose_destroy(Compose *compose)
hooks_unregister_hook(FOLDER_UPDATE_HOOKLIST,
compose->folder_update_callback_id);
- procmsg_msginfo_free(compose->targetinfo);
- procmsg_msginfo_free(compose->replyinfo);
- procmsg_msginfo_free(compose->fwdinfo);
+ procmsg_msginfo_free(&(compose->targetinfo));
+ procmsg_msginfo_free(&(compose->replyinfo));
+ procmsg_msginfo_free(&(compose->fwdinfo));
g_free(compose->replyto);
g_free(compose->cc);
@@ -10144,7 +10144,7 @@ gboolean compose_draft (gpointer data, guint action)
}
if (tmpinfo) {
msgnum = tmpinfo->msgnum;
- procmsg_msginfo_free(tmpinfo);
+ procmsg_msginfo_free(&tmpinfo);
debug_print("got draft msgnum %d from scanning\n", msgnum);
} else {
debug_print("didn't get draft msgnum after scanning\n");
@@ -10202,7 +10202,7 @@ warn_err:
if (action == COMPOSE_DRAFT_FOR_EXIT) {
compose_register_draft(newmsginfo);
}
- procmsg_msginfo_free(newmsginfo);
+ procmsg_msginfo_free(&newmsginfo);
}
folder_item_scan(draft);
@@ -10228,7 +10228,7 @@ warn_err:
}
g_free(path);
- procmsg_msginfo_free(compose->targetinfo);
+ procmsg_msginfo_free(&(compose->targetinfo));
compose->targetinfo = procmsg_msginfo_new();
compose->targetinfo->msgnum = msgnum;
compose->targetinfo->size = (goffset)s.st_size;
@@ -11872,7 +11872,7 @@ static void compose_reply_from_messageview_real(MessageView *msgview, GSList *ms
if (new_msglist) {
compose = compose_reply_mode((ComposeMode)action, new_msglist, body);
- procmsg_msginfo_free(tmp_msginfo);
+ procmsg_msginfo_free(&tmp_msginfo);
g_slist_free(new_msglist);
} else
compose = compose_reply_mode((ComposeMode)action, msginfo_list, body);
diff --git a/src/folder.c b/src/folder.c
index 705db37..f2237ec 100644
--- a/src/folder.c
+++ b/src/folder.c
@@ -1981,8 +1981,9 @@ static gint folder_item_syncronize_flags(FolderItem *item)
ret = syncronize_flags(item, msglist);
- for (cur = msglist; cur != NULL; cur = g_slist_next(cur))
- procmsg_msginfo_free((MsgInfo *) cur->data);
+ for (cur = msglist; cur != NULL; cur = g_slist_next(cur)) {
+ procmsg_msginfo_free((MsgInfo **)&(cur->data));
+ }
g_slist_free(msglist);
@@ -2062,7 +2063,7 @@ gint folder_item_close(FolderItem *item)
msginfo = (MsgInfo *) cur->data;
if (MSG_IS_NEW(msginfo->flags))
procmsg_msginfo_unset_flags(msginfo, MSG_NEW, 0);
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
}
g_slist_free(mlist);
folder_item_update_thaw();
@@ -2283,7 +2284,7 @@ gint folder_item_scan_full(FolderItem *item, gboolean filtering)
if (msginfo && folder->klass->is_msg_changed && folder->klass->is_msg_changed(folder, item, msginfo)) {
msgcache_remove_msg(item->cache, msginfo->msgnum);
new_list = g_slist_prepend(new_list, GINT_TO_POINTER(msginfo->msgnum));
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
debug_print("Remembering message %d to update...\n", folder_cur_num);
} else if (msginfo) {
@@ -2318,7 +2319,7 @@ gint folder_item_scan_full(FolderItem *item, gboolean filtering)
}
for(cache_list_cur = cache_list; cache_list_cur != NULL; cache_list_cur = g_slist_next(cache_list_cur))
- procmsg_msginfo_free((MsgInfo *) cache_list_cur->data);
+ procmsg_msginfo_free((MsgInfo **)&(cache_list_cur->data));
g_slist_free(cache_list);
g_slist_free(folder_list);
@@ -2373,7 +2374,7 @@ gint folder_item_scan_full(FolderItem *item, gboolean filtering)
if (to_filter != NULL) {
for (elem = to_filter; elem; elem = g_slist_next(elem)) {
MsgInfo *msginfo = (MsgInfo *)elem->data;
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
}
g_slist_free(to_filter);
}
@@ -2450,7 +2451,7 @@ gint folder_item_scan_full(FolderItem *item, gboolean filtering)
totalcnt++;
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
}
folder_item_set_batch(item, FALSE);
g_slist_free(exists_list);
@@ -2900,7 +2901,7 @@ gchar *folder_item_fetch_msg(FolderItem *item, gint num)
procmsg_msginfo_set_flags(msginfo, 0, MSG_SCANNED);
}
}
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
}
return msgfile;
@@ -2947,7 +2948,7 @@ gchar *folder_item_fetch_msg_full(FolderItem *item, gint num, gboolean headers,
procmsg_msginfo_set_flags(msginfo, 0, MSG_SCANNED);
}
}
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
}
return msgfile;
@@ -2994,7 +2995,7 @@ static gint folder_item_get_msg_num_by_file(FolderItem *dest, const gchar *file)
remove_space(hentry[0].body);
if ((msginfo = msgcache_get_msg_by_id(dest->cache, hentry[0].body)) != NULL) {
msgnum = msginfo->msgnum;
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
debug_print("found message as uid %d\n", msgnum);
}
@@ -3219,10 +3220,10 @@ gint folder_item_add_msgs(FolderItem *dest, GSList *file_list,
if (!folderscan &&
((newmsginfo = get_msginfo(dest, num)) != NULL)) {
add_msginfo_to_cache(dest, newmsginfo, NULL);
- procmsg_msginfo_free(newmsginfo);
+ procmsg_msginfo_free(&newmsginfo);
} else if ((newmsginfo = msgcache_get_msg(dest->cache, num)) != NULL) {
/* TODO: set default flags */
- procmsg_msginfo_free(newmsginfo);
+ procmsg_msginfo_free(&newmsginfo);
}
}
}
@@ -3622,7 +3623,7 @@ static gint do_copy_msgs(FolderItem *dest, GSList *msglist, gboolean remove_sour
hooks_invoke (MAIL_POSTFILTERING_HOOKLIST, newmsginfo);
}
}
- procmsg_msginfo_free(newmsginfo);
+ procmsg_msginfo_free(&newmsginfo);
if (num > lastnum)
@@ -3731,7 +3732,7 @@ gint folder_item_remove_msg(FolderItem *item, gint num)
msginfo = msgcache_get_msg(item->cache, num);
if (msginfo && MSG_IS_LOCKED(msginfo->flags)) {
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
return -1;
}
ret = folder->klass->remove_msg(folder, item, num);
@@ -3740,7 +3741,7 @@ gint folder_item_remove_msg(FolderItem *item, gint num)
if (msginfo != NULL) {
if (ret == 0)
remove_msginfo_from_cache(item, msginfo);
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
}
}
@@ -4463,8 +4464,7 @@ void folder_item_apply_processing(FolderItem *item)
|| post_global_processing)
filtering_move_and_copy_msgs(mlist);
for (cur = mlist ; cur != NULL ; cur = cur->next) {
- MsgInfo * msginfo = (MsgInfo *)cur->data;
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free((MsgInfo **)&(cur->data));
}
g_slist_free(mlist);
diff --git a/src/folderutils.c b/src/folderutils.c
index cd1735a..0a27229 100644
--- a/src/folderutils.c
+++ b/src/folderutils.c
@@ -108,7 +108,7 @@ gint folderutils_delete_duplicates(FolderItem *item,
for (cur = msglist; cur != NULL; cur = g_slist_next(cur)) {
MsgInfo *msginfo = (MsgInfo *) cur->data;
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
}
g_slist_free(msglist);
@@ -149,7 +149,7 @@ void folderutils_mark_all_read(FolderItem *item)
m++;
}
i++;
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
}
folder_item_set_batch(item, FALSE);
folder_item_close(item);
diff --git a/src/imap.c b/src/imap.c
index 96c7c3f..60c8e31 100644
--- a/src/imap.c
+++ b/src/imap.c
@@ -1540,7 +1540,7 @@ static gchar *imap_fetch_msg_full(Folder *folder, FolderItem *item, gint uid,
have_size, cached->size);
procmsg_msginfo_set_flags(cached, MSG_FULLY_CACHED, 0);
}
- procmsg_msginfo_free(cached);
+ procmsg_msginfo_free(&cached);
return filename;
} else if (!cached && time(NULL) - get_file_mtime(filename) < 60) {
debug_print("message not cached and file recent, considering file complete\n");
@@ -1548,18 +1548,18 @@ static gchar *imap_fetch_msg_full(Folder *folder, FolderItem *item, gint uid,
if (ok == 0)
return filename;
} else {
- procmsg_msginfo_free(cached);
+ procmsg_msginfo_free(&cached);
}
}
if (cached && MSG_IS_FULLY_CACHED(cached->flags)) {
- procmsg_msginfo_free(cached);
+ procmsg_msginfo_free(&cached);
return filename;
}
} else {
MsgInfo *cached = msgcache_get_msg(item->cache,uid);
if (cached) {
procmsg_msginfo_unset_flags(cached, MSG_FULLY_CACHED, 0);
- procmsg_msginfo_free(cached);
+ procmsg_msginfo_free(&cached);
}
}
@@ -1602,13 +1602,13 @@ static gchar *imap_fetch_msg_full(Folder *folder, FolderItem *item, gint uid,
MsgInfo *cached = msgcache_get_msg(item->cache,uid);
if (cached) {
procmsg_msginfo_set_flags(cached, MSG_FULLY_CACHED, 0);
- procmsg_msginfo_free(cached);
+ procmsg_msginfo_free(&cached);
}
} else if (ok == -1) {
MsgInfo *cached = msgcache_get_msg(item->cache,uid);
if (cached) {
procmsg_msginfo_unset_flags(cached, MSG_FULLY_CACHED, 0);
- procmsg_msginfo_free(cached);
+ procmsg_msginfo_free(&cached);
}
}
return filename;
@@ -1624,7 +1624,7 @@ static gboolean imap_is_msg_fully_cached(Folder *folder, FolderItem *item, gint
return FALSE;
if (MSG_IS_FULLY_CACHED(cached->flags)) {
- procmsg_msginfo_free(cached);
+ procmsg_msginfo_free(&cached);
return TRUE;
}
@@ -1644,11 +1644,11 @@ static gboolean imap_is_msg_fully_cached(Folder *folder, FolderItem *item, gint
if (cached && size >= cached->size) {
cached->total_size = cached->size;
procmsg_msginfo_set_flags(cached, MSG_FULLY_CACHED, 0);
- procmsg_msginfo_free(cached);
+ procmsg_msginfo_free(&cached);
return TRUE;
}
if (cached)
- procmsg_msginfo_free(cached);
+ procmsg_msginfo_free(&cached);
return FALSE;
}
@@ -5407,7 +5407,7 @@ static gint imap_get_flags(Folder *folder, FolderItem *item,
data->full_search = TRUE;
for (cur = tmp; cur; cur = cur->next)
- procmsg_msginfo_free((MsgInfo *)cur->data);
+ procmsg_msginfo_free((MsgInfo **)&(cur->data));
g_slist_free(tmp);
diff --git a/src/inc.c b/src/inc.c
index ebf2cc3..7714562 100644
--- a/src/inc.c
+++ b/src/inc.c
@@ -717,7 +717,7 @@ static gint inc_start(IncProgressDialog *inc_dialog)
for(msglist_element = msglist; msglist_element != NULL;
msglist_element = msglist_element->next) {
MsgInfo *msginfo = (MsgInfo *)msglist_element->data;
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free((MsgInfo**)&(msglist_element->data));
}
folder_item_update_thaw();
diff --git a/src/mainwindow.c b/src/mainwindow.c
index 07e89d6..6f8c19b 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -4833,7 +4833,7 @@ static void prev_history_cb(GtkAction *action, gpointer data)
folderview_select(mainwin->folderview, info->folder);
summary_display_by_msgnum(mainwin->summaryview, info->msgnum);
summary_display_msg_selected(mainwin->summaryview, FALSE);
- procmsg_msginfo_free(info);
+ procmsg_msginfo_free(&info);
main_window_set_menu_sensitive(mainwindow_get_mainwindow());
toolbar_main_set_sensitive(mainwindow_get_mainwindow());
}
@@ -4847,7 +4847,7 @@ static void next_history_cb(GtkAction *action, gpointer data)
if (info->folder != mainwin->summaryview->folder_item)
folderview_select(mainwin->folderview, info->folder);
summary_display_by_msgnum(mainwin->summaryview, info->msgnum);
- procmsg_msginfo_free(info);
+ procmsg_msginfo_free(&info);
main_window_set_menu_sensitive(mainwindow_get_mainwindow());
toolbar_main_set_sensitive(mainwindow_get_mainwindow());
}
@@ -5392,7 +5392,7 @@ void mainwindow_jump_to(const gchar *target, gboolean popup)
if (popup)
main_window_popup(mainwin);
g_free(tmp);
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
return;
} else {
g_print("'%s' not found\n", msg);
diff --git a/src/mbox.c b/src/mbox.c
index 95f1bd7..6b8ad38 100644
--- a/src/mbox.c
+++ b/src/mbox.c
@@ -278,7 +278,7 @@ gint proc_mbox(FolderItem *dest, const gchar *mbox, gboolean apply_filter,
filtering_move_and_copy_msgs(to_filter);
for (cur = filtered; cur; cur = g_slist_next(cur)) {
MsgInfo *info = (MsgInfo *)cur->data;
- procmsg_msginfo_free(info);
+ procmsg_msginfo_free(&info);
}
unfiltered = g_slist_reverse(unfiltered);
@@ -286,7 +286,7 @@ gint proc_mbox(FolderItem *dest, const gchar *mbox, gboolean apply_filter,
folder_item_move_msgs(dest, unfiltered);
for (cur = unfiltered; cur; cur = g_slist_next(cur)) {
MsgInfo *info = (MsgInfo *)cur->data;
- procmsg_msginfo_free(info);
+ procmsg_msginfo_free(&info);
}
}
diff --git a/src/messageview.c b/src/messageview.c
index 1329df6..8a164ee 100644
--- a/src/messageview.c
+++ b/src/messageview.c
@@ -1370,7 +1370,7 @@ gint messageview_show(MessageView *messageview, MsgInfo *msginfo,
}
if (messageview->msginfo != msginfo) {
- procmsg_msginfo_free(messageview->msginfo);
+ procmsg_msginfo_free(&(messageview->msginfo));
messageview->msginfo = NULL;
messageview_set_menu_sensitive(messageview);
messageview->msginfo =
@@ -1581,7 +1581,7 @@ void messageview_clear(MessageView *messageview)
{
if (!messageview)
return;
- procmsg_msginfo_free(messageview->msginfo);
+ procmsg_msginfo_free(&(messageview->msginfo));
messageview->msginfo = NULL;
messageview->filtered = FALSE;
@@ -1633,7 +1633,7 @@ void messageview_destroy(MessageView *messageview)
mimeview_destroy(messageview->mimeview);
noticeview_destroy(messageview->noticeview);
- procmsg_msginfo_free(messageview->msginfo);
+ procmsg_msginfo_free(&(messageview->msginfo));
toolbar_clear_list(TOOLBAR_MSGVIEW);
if (messageview->toolbar) {
toolbar_destroy(messageview->toolbar);
@@ -1978,7 +1978,7 @@ static void return_receipt_send_clicked(NoticeView *noticeview, MsgInfo *msginfo
noticeview_hide(noticeview);
}
- procmsg_msginfo_free(tmpmsginfo);
+ procmsg_msginfo_free(&tmpmsginfo);
g_free(file);
}
@@ -2554,7 +2554,7 @@ static void prev_history_cb(GtkAction *action, gpointer data)
messageview_show(messageview, info,
messageview->all_headers);
messageview->updating = FALSE;
- procmsg_msginfo_free(info);
+ procmsg_msginfo_free(&info);
if (messageview->deferred_destroy) {
debug_print("messageview got away!\n");
messageview_destroy(messageview);
@@ -2572,7 +2572,7 @@ static void next_history_cb(GtkAction *action, gpointer data)
messageview_show(messageview, info,
messageview->all_headers);
messageview->updating = FALSE;
- procmsg_msginfo_free(info);
+ procmsg_msginfo_free(&info);
if (messageview->deferred_destroy) {
debug_print("messageview got away!\n");
messageview_destroy(messageview);
@@ -2748,7 +2748,7 @@ static void show_all_header_cb(GtkToggleAction *action, gpointer data)
if (!msginfo) return;
messageview->msginfo = NULL;
messageview_show(messageview, msginfo, messageview->all_headers);
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
main_window_set_menu_sensitive(messageview->mainwin);
summary_redisplay_msg(messageview->mainwin->summaryview);
}
@@ -2780,7 +2780,7 @@ static void msg_hide_quotes_cb(GtkToggleAction *action, gpointer data)
messageview->msginfo = NULL;
messageview_show(messageview, msginfo,
messageview->all_headers);
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
/* update main window */
main_window_set_menu_sensitive(messageview->mainwin);
@@ -2869,7 +2869,7 @@ static void add_address_cb(GtkAction *action, gpointer data)
avatarr = avatars_avatarrender_new(full_msginfo);
hooks_invoke(AVATAR_IMAGE_RENDER_HOOKLIST, avatarr);
- procmsg_msginfo_free(full_msginfo);
+ procmsg_msginfo_free(&full_msginfo);
if (avatarr->image != NULL)
picture = gtk_image_get_pixbuf(GTK_IMAGE(avatarr->image));
diff --git a/src/mh.c b/src/mh.c
index e46024f..dbf250c 100644
--- a/src/mh.c
+++ b/src/mh.c
@@ -930,7 +930,7 @@ static FolderItem *mh_create_folder(Folder *folder, FolderItem *parent,
MsgInfo *info = folder_item_get_msginfo(parent, to_number(name));
if (info != NULL) {
gboolean ok = mh_renumber_msg(info);
- procmsg_msginfo_free(info);
+ procmsg_msginfo_free(&info);
if (!ok) {
g_free(fullpath);
return NULL;
diff --git a/src/msgcache.c b/src/msgcache.c
index ba29213..edaa092 100644
--- a/src/msgcache.c
+++ b/src/msgcache.c
@@ -140,7 +140,7 @@ MsgCache *msgcache_new(void)
static gboolean msgcache_msginfo_free_func(gpointer num, gpointer msginfo, gpointer user_data)
{
- procmsg_msginfo_free((MsgInfo *)msginfo);
+ procmsg_msginfo_free((MsgInfo **)&msginfo);
return TRUE;
}
@@ -190,7 +190,7 @@ void msgcache_remove_msg(MsgCache *cache, guint msgnum)
msginfo->folder->cache_dirty = TRUE;
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
cache->last_access = time(NULL);
@@ -210,7 +210,7 @@ void msgcache_update_msg(MsgCache *cache, MsgInfo *msginfo)
if (oldmsginfo) {
g_hash_table_remove(cache->msgnum_table, &oldmsginfo->msgnum);
cache->memusage -= procmsg_msginfo_memusage(oldmsginfo);
- procmsg_msginfo_free(oldmsginfo);
+ procmsg_msginfo_free(&oldmsginfo);
}
newmsginfo = procmsg_msginfo_new_ref(msginfo);
@@ -299,7 +299,7 @@ gint msgcache_get_memory_usage(MsgCache *cache)
#define READ_CACHE_DATA(data, fp, total_len) \
{ \
if ((tmp_len = msgcache_read_cache_data_str(fp, &data, conv)) < 0) { \
- procmsg_msginfo_free(msginfo); \
+ procmsg_msginfo_free(&msginfo); \
error = TRUE; \
goto bail_err; \
} \
@@ -314,7 +314,7 @@ gint msgcache_get_memory_usage(MsgCache *cache)
if ((ni = fread(&idata, sizeof(idata), 1, fp)) != 1) { \
g_warning("read_int: Cache data corrupted, read %zd of %zd at " \
"offset %ld", ni, sizeof(idata), ftell(fp)); \
- procmsg_msginfo_free(msginfo); \
+ procmsg_msginfo_free(&msginfo); \
error = TRUE; \
goto bail_err; \
} else \
@@ -342,7 +342,7 @@ gint msgcache_get_memory_usage(MsgCache *cache)
} \
if ((tmp_len = msgcache_get_cache_data_str(walk_data, &data, tmp_len, conv)) < 0) { \
g_print("error at rem_len:%d\n", rem_len);\
- procmsg_msginfo_free(msginfo); \
+ procmsg_msginfo_free(&msginfo); \
error = TRUE; \
goto bail_err; \
} \
diff --git a/src/partial_download.c b/src/partial_download.c
index 8a385b6..5694b0d 100644
--- a/src/partial_download.c
+++ b/src/partial_download.c
@@ -328,7 +328,7 @@ static int partial_uidl_mark_mail(MsgInfo *msginfo, int download)
err = 0;
bail:
g_free(filename);
- procmsg_msginfo_free(tinfo);
+ procmsg_msginfo_free(&tinfo);
return err;
}
diff --git a/src/plugins/att_remover/att_remover.c b/src/plugins/att_remover/att_remover.c
index 4711f4f..c1cec12 100644
--- a/src/plugins/att_remover/att_remover.c
+++ b/src/plugins/att_remover/att_remover.c
@@ -116,7 +116,7 @@ static gint save_new_message(MsgInfo *oldmsg, MsgInfo *newmsg, MimeInfo *info,
finalmsg = procmsg_msginfo_new_from_mimeinfo(newmsg, info);
if (!finalmsg) {
- procmsg_msginfo_free(newmsg);
+ procmsg_msginfo_free(&newmsg);
return -1;
}
@@ -133,14 +133,14 @@ static gint save_new_message(MsgInfo *oldmsg, MsgInfo *newmsg, MimeInfo *info,
msgnum = folder_item_add_msg(item, finalmsg->plaintext_file,
&flags, TRUE);
finalmsg->msgnum = msgnum;
- procmsg_msginfo_free(newmsg);
- procmsg_msginfo_free(finalmsg);
+ procmsg_msginfo_free(&newmsg);
+ procmsg_msginfo_free(&finalmsg);
newmsg = folder_item_get_msginfo(item, msgnum);
if (newmsg && item) {
procmsg_msginfo_unset_flags(newmsg, ~0, ~0);
procmsg_msginfo_set_flags(newmsg, flags.perm_flags, flags.tmp_flags);
- procmsg_msginfo_free(newmsg);
+ procmsg_msginfo_free(&newmsg);
}
return msgnum;
@@ -168,7 +168,7 @@ static void remove_attachments_cb(GtkWidget *widget, AttRemover *attremover)
partinfo = procmime_mimeinfo_next(partinfo);
if (!partinfo || !gtk_tree_model_get_iter_first(model, &iter)) {
gtk_widget_destroy(attremover->window);
- procmsg_msginfo_free(newmsg);
+ procmsg_msginfo_free(&newmsg);
return;
}
@@ -440,7 +440,7 @@ static void remove_attachments(GSList *msglist)
info = procmime_scan_message(newmsg);
if ( !(partinfo = find_first_text_part(info)) ) {
- procmsg_msginfo_free(newmsg);
+ procmsg_msginfo_free(&newmsg);
continue;
}
partinfo->node->next = NULL;
diff --git a/src/plugins/vcalendar/common-views.c b/src/plugins/vcalendar/common-views.c
index e627c29..ad1e80d 100644
--- a/src/plugins/vcalendar/common-views.c
+++ b/src/plugins/vcalendar/common-views.c
@@ -209,7 +209,7 @@ void vcal_view_select_event (const gchar *uid, FolderItem *item, gboolean edit,
G_CALLBACK(block_cb), block_data);
summary_select_by_msgnum(summaryview, info->msgnum);
summary_display_msg_selected(summaryview, FALSE);
- procmsg_msginfo_free(info);
+ procmsg_msginfo_free(&info);
g_signal_handlers_unblock_by_func(G_OBJECT(summaryview->ctree),
G_CALLBACK(block_cb), block_data);
}
diff --git a/src/plugins/vcalendar/vcal_folder.c b/src/plugins/vcalendar/vcal_folder.c
index 266f486..c52a399 100644
--- a/src/plugins/vcalendar/vcal_folder.c
+++ b/src/plugins/vcalendar/vcal_folder.c
@@ -1053,7 +1053,7 @@ static gint vcal_remove_msg(Folder *folder, FolderItem *_item, gint num)
if (_item == folder->inbox)
vcal_remove_event(folder, msginfo);
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
return 0;
}
@@ -2417,7 +2417,7 @@ gboolean vcal_event_exists(const gchar *id)
info = folder_item_get_msginfo_by_msgid(folder->inbox, id);
if (info != NULL) {
- procmsg_msginfo_free(info);
+ procmsg_msginfo_free(&info);
return TRUE;
}
return FALSE;
@@ -2455,7 +2455,7 @@ gboolean vcal_delete_event(const gchar *id)
if (info != NULL) {
debug_print("removing event %s\n", id);
vcal_remove_event(folder, info);
- procmsg_msginfo_free(info);
+ procmsg_msginfo_free(&info);
folder_item_scan(folder->inbox);
return TRUE;
}
diff --git a/src/plugins/vcalendar/vcalendar.c b/src/plugins/vcalendar/vcalendar.c
index 2a924e4..a47f862 100644
--- a/src/plugins/vcalendar/vcalendar.c
+++ b/src/plugins/vcalendar/vcalendar.c
@@ -217,7 +217,7 @@ bail:
g_free(url);
}
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
}
statusbar_progress_all(0,0,0);
diff --git a/src/procmime.c b/src/procmime.c
index cce1695..bcb3db2 100644
--- a/src/procmime.c
+++ b/src/procmime.c
@@ -1584,7 +1584,7 @@ static void procmime_parse_disposition_notification(MimeInfo *mimeinfo,
debug_print("%s %s in %s\n", info?"found":"didn't find", orig_msg_id, outbox->path);
if (info) {
procmsg_msginfo_set_flags(info, MSG_RETRCPT_GOT, 0);
- procmsg_msginfo_free(info);
+ procmsg_msginfo_free(&info);
}
}
}
diff --git a/src/procmsg.c b/src/procmsg.c
index 9fb33a2..d47ebaf 100644
--- a/src/procmsg.c
+++ b/src/procmsg.c
@@ -84,7 +84,7 @@ void procmsg_msg_list_free(GSList *mlist)
for (cur = mlist; cur != NULL; cur = cur->next) {
msginfo = (MsgInfo *)cur->data;
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
}
g_slist_free(mlist);
}
@@ -469,7 +469,7 @@ void procmsg_message_file_list_free(MsgInfoList *file_list)
for (cur = file_list; cur != NULL; cur = cur->next) {
fileinfo = (MsgFileInfo *)cur->data;
- procmsg_msginfo_free(fileinfo->msginfo);
+ procmsg_msginfo_free(&(fileinfo->msginfo));
g_free(fileinfo->file);
g_free(fileinfo->flags);
g_free(fileinfo);
@@ -680,14 +680,14 @@ static void procmsg_empty_trash(FolderItem *trash)
for (cur = mlist ; cur != NULL ; cur = cur->next) {
MsgInfo * msginfo = (MsgInfo *) cur->data;
if (MSG_IS_LOCKED(msginfo->flags)) {
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
continue;
}
if (msginfo->total_size != 0 &&
msginfo->size != (off_t)msginfo->total_size)
partial_mark_for_delete(msginfo);
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
}
g_slist_free(mlist);
folder_item_remove_all_msg(trash);
@@ -1014,7 +1014,7 @@ gint procmsg_send_queue(FolderItem *queue, gboolean save_msgs, gchar **errstr)
/* FIXME: supposedly if only one message is locked, and queue
* is being flushed, the following free says something like
* "freeing msg ## in folder (nil)". */
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
}
g_slist_free(sorted_list);
@@ -1169,14 +1169,14 @@ gint procmsg_save_to_outbox(FolderItem *outbox, const gchar *file,
tmp_msginfo = procmsg_msginfo_get_full_info(msginfo); /* refcnt++ */
if (msginfo != NULL) {
procmsg_msginfo_unset_flags(msginfo, ~0, 0);
- procmsg_msginfo_free(msginfo); /* refcnt-- */
+ procmsg_msginfo_free(&msginfo); /* refcnt-- */
/* tmp_msginfo == msginfo */
if (tmp_msginfo && msginfo->extradata &&
(msginfo->extradata->dispositionnotificationto ||
msginfo->extradata->returnreceiptto)) {
procmsg_msginfo_set_flags(msginfo, MSG_RETRCPT_SENT, 0);
}
- procmsg_msginfo_free(tmp_msginfo); /* refcnt-- */
+ procmsg_msginfo_free(&tmp_msginfo); /* refcnt-- */
}
return 0;
@@ -1346,7 +1346,7 @@ MsgInfo *procmsg_msginfo_get_full_info_from_file(MsgInfo *msginfo, const gchar *
msginfo->extradata->resent_from = g_strdup
(full_msginfo->extradata->resent_from);
}
- procmsg_msginfo_free(full_msginfo);
+ procmsg_msginfo_free(&full_msginfo);
return procmsg_msginfo_new_ref(msginfo);
}
@@ -1373,8 +1373,11 @@ MsgInfo *procmsg_msginfo_get_full_info(MsgInfo *msginfo)
return full_msginfo;
}
-void procmsg_msginfo_free(MsgInfo *msginfo)
+#define FREENULL(n) { g_free(n); n = NULL; }
+void procmsg_msginfo_free(MsgInfo **msginfo_ptr)
{
+ MsgInfo *msginfo = *msginfo_ptr;
+
if (msginfo == NULL) return;
msginfo->refcnt--;
@@ -1386,19 +1389,19 @@ void procmsg_msginfo_free(MsgInfo *msginfo)
folder_item_update(msginfo->to_folder, F_ITEM_UPDATE_MSGCNT);
}
- g_free(msginfo->fromspace);
+ FREENULL(msginfo->fromspace);
- g_free(msginfo->fromname);
+ FREENULL(msginfo->fromname);
- g_free(msginfo->date);
- g_free(msginfo->from);
- g_free(msginfo->to);
- g_free(msginfo->cc);
- g_free(msginfo->newsgroups);
- g_free(msginfo->subject);
- g_free(msginfo->msgid);
- g_free(msginfo->inreplyto);
- g_free(msginfo->xref);
+ FREENULL(msginfo->date);
+ FREENULL(msginfo->from);
+ FREENULL(msginfo->to);
+ FREENULL(msginfo->cc);
+ FREENULL(msginfo->newsgroups);
+ FREENULL(msginfo->subject);
+ FREENULL(msginfo->msgid);
+ FREENULL(msginfo->inreplyto);
+ FREENULL(msginfo->xref);
if (msginfo->extradata) {
if (msginfo->extradata->avatars) {
@@ -1407,27 +1410,28 @@ void procmsg_msginfo_free(MsgInfo *msginfo)
NULL);
g_slist_free(msginfo->extradata->avatars);
}
- g_free(msginfo->extradata->returnreceiptto);
- g_free(msginfo->extradata->dispositionnotificationto);
- g_free(msginfo->extradata->list_post);
- g_free(msginfo->extradata->list_subscribe);
- g_free(msginfo->extradata->list_unsubscribe);
- g_free(msginfo->extradata->list_help);
- g_free(msginfo->extradata->list_archive);
- g_free(msginfo->extradata->list_owner);
- g_free(msginfo->extradata->partial_recv);
- g_free(msginfo->extradata->account_server);
- g_free(msginfo->extradata->account_login);
- g_free(msginfo->extradata->resent_from);
- g_free(msginfo->extradata);
+ FREENULL(msginfo->extradata->returnreceiptto);
+ FREENULL(msginfo->extradata->dispositionnotificationto);
+ FREENULL(msginfo->extradata->list_post);
+ FREENULL(msginfo->extradata->list_subscribe);
+ FREENULL(msginfo->extradata->list_unsubscribe);
+ FREENULL(msginfo->extradata->list_help);
+ FREENULL(msginfo->extradata->list_archive);
+ FREENULL(msginfo->extradata->list_owner);
+ FREENULL(msginfo->extradata->partial_recv);
+ FREENULL(msginfo->extradata->account_server);
+ FREENULL(msginfo->extradata->account_login);
+ FREENULL(msginfo->extradata->resent_from);
+ FREENULL(msginfo->extradata);
}
slist_free_strings_full(msginfo->references);
g_slist_free(msginfo->tags);
- g_free(msginfo->plaintext_file);
+ FREENULL(msginfo->plaintext_file);
- g_free(msginfo);
+ FREENULL(msginfo);
}
+#undef FREENULL
guint procmsg_msginfo_memusage(MsgInfo *msginfo)
{
@@ -1751,7 +1755,7 @@ send_mail:
debug_print("copied queued mail %d to sent folder\n", msgnum);
saved = TRUE;
}
- procmsg_msginfo_free(queued_mail);
+ procmsg_msginfo_free(&queued_mail);
}
if (!saved) {
debug_print("resaving queued mail to sent folder\n");
@@ -1780,7 +1784,7 @@ send_mail:
if ((msginfo != NULL) &&
(msginfo->msgid != NULL) &&
(strcmp(msginfo->msgid, tokens[2]) != 0)) {
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
msginfo = NULL;
}
@@ -1800,7 +1804,7 @@ send_mail:
} else {
procmsg_msginfo_set_flags(msginfo, MSG_FORWARDED, 0);
}
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
}
}
g_strfreev(tokens);
@@ -2059,7 +2063,7 @@ static gboolean procmsg_msg_has_flagged_parent_real(MsgInfo *info,
tmp = folder_item_get_msginfo_by_msgid(info->folder,
info->inreplyto);
if (tmp && (tmp->flags.perm_flags & perm_flags)) {
- procmsg_msginfo_free(tmp);
+ procmsg_msginfo_free(&tmp);
return TRUE;
} else if (tmp != NULL) {
gboolean result;
@@ -2073,7 +2077,7 @@ static gboolean procmsg_msg_has_flagged_parent_real(MsgInfo *info,
result = procmsg_msg_has_flagged_parent_real(
tmp, perm_flags, parentmsgs);
}
- procmsg_msginfo_free(tmp);
+ procmsg_msginfo_free(&tmp);
return result;
} else {
return FALSE;
@@ -2158,7 +2162,7 @@ static GSList *procmsg_find_children (MsgInfo *info)
for (cur = all; cur != NULL; cur = g_slist_next(cur)) {
/* this will not free the used pointers
created with procmsg_msginfo_new_ref */
- procmsg_msginfo_free((MsgInfo *)cur->data);
+ procmsg_msginfo_free((MsgInfo **)&(cur->data));
}
}
g_slist_free(all);
@@ -2179,7 +2183,7 @@ static void procmsg_update_unread_children(MsgInfo *info, gboolean newly_marked)
info->folder->unreadmarked_msgs--;
folder_item_update(info->folder, F_ITEM_UPDATE_MSGCNT);
}
- procmsg_msginfo_free(tmp);
+ procmsg_msginfo_free(&tmp);
}
g_slist_free(children);
}
diff --git a/src/procmsg.h b/src/procmsg.h
index 5152c05..9b143f1 100644
--- a/src/procmsg.h
+++ b/src/procmsg.h
@@ -342,7 +342,7 @@ MsgInfo *procmsg_msginfo_get_full_info (MsgInfo *msginfo);
MsgInfo *procmsg_msginfo_get_full_info_from_file
(MsgInfo *msginfo,
const gchar *file);
-void procmsg_msginfo_free (MsgInfo *msginfo);
+void procmsg_msginfo_free (MsgInfo **msginfo);
guint procmsg_msginfo_memusage (MsgInfo *msginfo);
gint procmsg_send_message_queue_with_lock(const gchar *file,
diff --git a/src/send_message.c b/src/send_message.c
index be2733d..18f7f3a 100644
--- a/src/send_message.c
+++ b/src/send_message.c
@@ -251,7 +251,7 @@ gint send_message_smtp_full(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp, g
strncpy2(spec_from, ac_prefs->address, BUFFSIZE-1);
}
if (tmp_msginfo) {
- procmsg_msginfo_free(tmp_msginfo);
+ procmsg_msginfo_free(&tmp_msginfo);
}
if (!ac_prefs->session) {
diff --git a/src/summaryview.c b/src/summaryview.c
index e1914cf..df0986e 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -1408,7 +1408,7 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item)
if (!msginfo->hidden) {
if (MSG_IS_DELETED(msginfo->flags) && summaryview->folder_item->hide_del_msgs) {
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
continue;
}
if (summaryview->folder_item->hide_read_msgs) {
@@ -1423,12 +1423,12 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item)
msginfo->msgnum == displayed_msgnum))
not_killed = g_slist_prepend(not_killed, msginfo);
else
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
} else {
not_killed = g_slist_prepend(not_killed, msginfo);
}
} else
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
}
hidden_removed = TRUE;
g_slist_free(mlist);
@@ -1451,7 +1451,7 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item)
if (!msginfo->hidden)
not_killed = g_slist_prepend(not_killed, msginfo);
else
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
}
g_slist_free(mlist);
mlist = not_killed;
@@ -2499,7 +2499,7 @@ static void summary_free_msginfo_func(GtkCMCTree *ctree, GtkCMCTreeNode *node,
MsgInfo *msginfo = gtk_cmctree_node_get_row_data(ctree, node);
if (msginfo)
- procmsg_msginfo_free(msginfo);
+ procmsg_msginfo_free(&msginfo);
}
static void summary_set_marks_func(GtkCMCTree *ctree, GtkCMCTreeNode *node,
@@ -3563,7 +3563,7 @@ static int msginfo_mark_as_read_timeout(void *data)
if (mdata->msginfo == summary_get_selected_msg(mdata->summaryview))
msginfo_mark_as_read(mdata->summaryview, mdata->msginfo,
mdata->summaryview->selected);
- procmsg_msginfo_free(mdata->msginfo);
+ procmsg_msginfo_free(&(mdata->msginfo));
mdata->summaryview->mark_as_read_timeout_tag = 0;
summary_unlock(mdata->summaryview);
@@ -4733,7 +4733,7 @@ void summary_add_address(SummaryView *summaryview)
avatarr = avatars_avatarrender_new(full_msginfo);
hooks_invoke(AVATAR_IMAGE_RENDER_HOOKLIST, avatarr);
- procmsg_msginfo_free(full_msginfo);
+ procmsg_msginfo_free(&full_msginfo);
if (avatarr->image)
picture = gtk_image_get_pixbuf(GTK_IMAGE(avatarr->image));
@@ -5161,7 +5161,7 @@ static gint summary_execute_move(SummaryView *summaryview)
if (!summaryview->folder_item->folder->account || summaryview->folder_item->folder->account->imap_use_trash) {
for (cur = summaryview->mlist; cur != NULL && cur->data != NULL; cur = cur->next)
- procmsg_msginfo_free((MsgInfo *)cur->data);
+ procmsg_msginfo_free((MsgInfo **)&(cur->data));
}
if (summaryview->folder_item->folder->account && !summaryview->folder_item->folder->account->imap_use_trash) {
gtk_cmctree_pre_recursive(ctree, NULL, summary_set_deleted_func,
@@ -5267,7 +5267,7 @@ static void summary_execute_delete(SummaryView *summaryview)
summary_update_msg, (gpointer) summaryview);
if (!summaryview->folder_item->folder->account || summaryview->folder_item->folder->account->imap_use_trash) {
for (cur = summaryview->mlist; cur != NULL && cur->data != NULL; cur = cur->next)
- procmsg_msginfo_free((MsgInfo *)cur->data);
+ procmsg_msginfo_free((MsgInfo **)&(cur->data));
}
g_slist_free(summaryview->mlist);
summaryview->mlist = NULL;
@@ -5348,7 +5348,7 @@ static void summary_execute_expunge(SummaryView *summaryview)
hooks_register_hook(MSGINFO_UPDATE_HOOKLIST,
summary_update_msg, (gpointer) summaryview);
for (cur = summaryview->mlist; cur != NULL && cur->data != NULL; cur = cur->next)
- procmsg_msginfo_free((MsgInfo *)cur->data);
+ procmsg_msginfo_free((MsgInfo **)&(cur->data));
g_slist_free(summaryview->mlist);
summaryview->mlist = NULL;
@@ -5710,7 +5710,7 @@ void summary_filter(SummaryView *summaryview, gboolean selected_only)
filtering_move_and_copy_msgs(mlist);
for (cur_list = mlist; cur_list; cur_list = cur_list->next) {
- procmsg_msginfo_free((MsgInfo *)cur_list->data);
+ procmsg_msginfo_free((MsgInfo **)&(cur_list->data));
}
g_slist_free(mlist);
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list