Make procmsg_msginfo_free() zero out pointers to freed memory.
authorAndrej Kacian <ticho@claws-mail.org>
Sat, 23 Jan 2016 14:40:38 +0000 (15:40 +0100)
committerAndrej Kacian <ticho@claws-mail.org>
Sat, 23 Jan 2016 15:45:02 +0000 (16:45 +0100)
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.

21 files changed:
src/action.c
src/compose.c
src/folder.c
src/folderutils.c
src/imap.c
src/inc.c
src/mainwindow.c
src/mbox.c
src/messageview.c
src/mh.c
src/msgcache.c
src/partial_download.c
src/plugins/att_remover/att_remover.c
src/plugins/vcalendar/common-views.c
src/plugins/vcalendar/vcal_folder.c
src/plugins/vcalendar/vcalendar.c
src/procmime.c
src/procmsg.c
src/procmsg.h
src/send_message.c
src/summaryview.c

index 86fd1989268edfd70e463b953b5d26df7c8ffa28..e78bf477b93db3d8d9b398a62f7a2d13cae8f53b 100644 (file)
@@ -1445,7 +1445,7 @@ static void catch_status(GPid pid, gint status, gpointer data)
                                modified_something = TRUE;
                                last_item = nmi->folder;
                        }
                                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)
                        if (summaryview && summaryview->displayed &&
                            summaryview->folder_item == msginfo->folder &&
                            summary_get_msgnum(summaryview, summaryview->displayed) == msginfo->msgnum)
index 81947e73394fb78ccceedbcc548c37e2bfda4bd9..af64a8327c220c2d78638689d3b35ddf23b4965e 100644 (file)
@@ -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;
 
        if (attach_files) {
                GList *curr;
@@ -1826,7 +1826,7 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
                quote_fmt_reset_vartable();
 
                g_free(tmp);
                quote_fmt_reset_vartable();
 
                g_free(tmp);
-               procmsg_msginfo_free(full_msginfo);
+               procmsg_msginfo_free(&full_msginfo);
        }
 
        textview = GTK_TEXT_VIEW(compose->text);
        }
 
        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);
 
                quote_fmt_reset_vartable();
                compose_attach_parts(compose, msginfo);
 
-               procmsg_msginfo_free(full_msginfo);
+               procmsg_msginfo_free(&full_msginfo);
        }
 
        SIGNAL_BLOCK(textbuf);
        }
 
        SIGNAL_BLOCK(textbuf);
@@ -3189,7 +3189,7 @@ error:
 ok:
        SIGNAL_UNBLOCK(buffer);
 
 ok:
        SIGNAL_UNBLOCK(buffer);
 
-       procmsg_msginfo_free( dummyinfo );
+       procmsg_msginfo_free( &dummyinfo );
 
        return buf;
 }
 
        return buf;
 }
@@ -3778,7 +3778,7 @@ static gboolean compose_attach_append(Compose *compose, const gchar *file,
 
                        ainfo->name = g_strdup_printf(_("Message: %s"), name);
 
 
                        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);
                } 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);
                                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);
                        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) {
                        }
                }
                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);
 
                        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 );
                } 
 
                        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)
 }
 
 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);
 
        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);
 
        g_free(compose->replyto);
        g_free(compose->cc);
@@ -10144,7 +10144,7 @@ gboolean compose_draft (gpointer data, guint action)
                }
                if (tmpinfo) {
                        msgnum = tmpinfo->msgnum;
                }
                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");
                        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);
                }
                if (action == COMPOSE_DRAFT_FOR_EXIT) {
                        compose_register_draft(newmsginfo);
                }
-               procmsg_msginfo_free(newmsginfo);
+               procmsg_msginfo_free(&newmsginfo);
        }
        
        folder_item_scan(draft);
        }
        
        folder_item_scan(draft);
@@ -10228,7 +10228,7 @@ warn_err:
                }
                g_free(path);
 
                }
                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;
                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);
 
        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);
                g_slist_free(new_msglist);
        } else
                compose = compose_reply_mode((ComposeMode)action, msginfo_list, body);
index 705db376157721420e245a084189537f7fdbfc75..f2237ecce7c960980c0cecc4c857f1b38bc86f82 100644 (file)
@@ -1981,8 +1981,9 @@ static gint folder_item_syncronize_flags(FolderItem *item)
        
        ret = syncronize_flags(item, msglist);
 
        
        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);
 
        
        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);
                        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();
                }
                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));
                        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) {
 
                                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))
        }
        
        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);
 
        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;
                        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);
                        }
                                }
                                g_slist_free(to_filter);
                        }
@@ -2450,7 +2451,7 @@ gint folder_item_scan_full(FolderItem *item, gboolean filtering)
 
                totalcnt++;
 
 
                totalcnt++;
 
-               procmsg_msginfo_free(msginfo);
+               procmsg_msginfo_free(&msginfo);
        }
        folder_item_set_batch(item, FALSE);
        g_slist_free(exists_list);
        }
        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_set_flags(msginfo, 0, MSG_SCANNED);
                        }
                }
-               procmsg_msginfo_free(msginfo);
+               procmsg_msginfo_free(&msginfo);
        }
 
        return msgfile;
        }
 
        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_set_flags(msginfo, 0, MSG_SCANNED);
                        }
                }
-               procmsg_msginfo_free(msginfo);
+               procmsg_msginfo_free(&msginfo);
        }
 
        return msgfile;
        }
 
        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;
                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);
                }
 
                        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);
                        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 */
                        } 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);
                                }
                        }
                                        hooks_invoke (MAIL_POSTFILTERING_HOOKLIST, newmsginfo);
                                }
                        }
-                       procmsg_msginfo_free(newmsginfo);
+                       procmsg_msginfo_free(&newmsginfo);
 
 
                        if (num > lastnum)
 
 
                        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)) {
 
        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);
                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);
                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) {
            || 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);
        
        }
        g_slist_free(mlist);
        
index cd1735a2c6f25bf85881f916583b18151accf5c2..0a272292f4ea17827a14aa93f99cf3fe088d2530 100644 (file)
@@ -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;
 
        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);
 
        }
        g_slist_free(msglist);
 
@@ -149,7 +149,7 @@ void folderutils_mark_all_read(FolderItem *item)
                                m++;
                        }
                        i++;
                                m++;
                        }
                        i++;
-                       procmsg_msginfo_free(msginfo);
+                       procmsg_msginfo_free(&msginfo);
                }
                folder_item_set_batch(item, FALSE);
                folder_item_close(item);
                }
                folder_item_set_batch(item, FALSE);
                folder_item_close(item);
index 96c7c3f3dd635c89e4127487467bb544c37fc069..60c8e315959db56b6a0b24a58762ac074ed33ad7 100644 (file)
@@ -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);
                                }
                                                        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");
                                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 {
                                if (ok == 0)
                                        return filename;
                        } else {
-                               procmsg_msginfo_free(cached);
+                               procmsg_msginfo_free(&cached);
                        }
                }
                if (cached && MSG_IS_FULLY_CACHED(cached->flags)) {
                        }
                }
                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);
                        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);
                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);
                }
        } 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;
                }
        }
        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)) {
                return FALSE;
 
        if (MSG_IS_FULLY_CACHED(cached->flags)) {
-               procmsg_msginfo_free(cached);
+               procmsg_msginfo_free(&cached);
                return TRUE;
        }
 
                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);
        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)
                return TRUE;
        }
        if (cached)
-               procmsg_msginfo_free(cached);
+               procmsg_msginfo_free(&cached);
        return FALSE;   
 }
 
        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)
                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);
 
        
        g_slist_free(tmp);
 
index ebf2cc380d5b01b9eedb76807bea26c5c734a3f0..7714562aa7c52cc77e74bb8a813a4ac1bcba7454 100644 (file)
--- 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;
                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();
                
                }
                folder_item_update_thaw();
                
index 07e89d666f4a285fffa53aad868e9c942d472876..6f8c19b6ec388843d163ff146832c047e72d7cd4 100644 (file)
@@ -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);
                        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());
        }
                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);
                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());
        }
                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);
                                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);
                                return;
                        } else {
                                g_print("'%s' not found\n", msg);
index 95f1bd78054cc93c960af3dcdccf0fb10b1a7aa8..6b8ad38b664381a291c417a86872ee183c8bf2a3 100644 (file)
@@ -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;
                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);
                }
 
                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;
                        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);
                        }
                }
 
                        }
                }
 
index 1329df647783da5ebfbd61e9df2d7083926bd99b..8a164eeb24d73ba7df89e24cab63223cc4d8743a 100644 (file)
@@ -1370,7 +1370,7 @@ gint messageview_show(MessageView *messageview, MsgInfo *msginfo,
        }
                        
        if (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 = 
                messageview->msginfo = NULL;
                messageview_set_menu_sensitive(messageview);
                messageview->msginfo = 
@@ -1581,7 +1581,7 @@ void messageview_clear(MessageView *messageview)
 {
        if (!messageview)
                return;
 {
        if (!messageview)
                return;
-       procmsg_msginfo_free(messageview->msginfo);
+       procmsg_msginfo_free(&(messageview->msginfo));
        messageview->msginfo = NULL;
        messageview->filtered = FALSE;
 
        messageview->msginfo = NULL;
        messageview->filtered = FALSE;
 
@@ -1633,7 +1633,7 @@ void messageview_destroy(MessageView *messageview)
        mimeview_destroy(messageview->mimeview);
        noticeview_destroy(messageview->noticeview);
 
        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);
        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);
        }               
 
                noticeview_hide(noticeview);
        }               
 
-       procmsg_msginfo_free(tmpmsginfo);
+       procmsg_msginfo_free(&tmpmsginfo);
        g_free(file);
 }
 
        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;
                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);
                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;
                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);
                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);
        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);
 }
        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);
        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);
        
        /* 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);
 
        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));
 
        if (avatarr->image != NULL)
                picture = gtk_image_get_pixbuf(GTK_IMAGE(avatarr->image));
index e46024f496d006d75cce4da7c74afbd4330ca7dc..dbf250c37132ffac6275f5def3bba9ecdc8e0abb 100644 (file)
--- 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);
                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;
                        if (!ok) {
                                g_free(fullpath);
                                return NULL;
index ba292132ea08f1773854810ea913dd3579f1a403..edaa0924c703bf558227f0fe86ad72a2262cb691 100644 (file)
@@ -140,7 +140,7 @@ MsgCache *msgcache_new(void)
 
 static gboolean msgcache_msginfo_free_func(gpointer num, gpointer msginfo, gpointer user_data)
 {
 
 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;
 }                                                                                        
 
        return TRUE;
 }                                                                                        
 
@@ -190,7 +190,7 @@ void msgcache_remove_msg(MsgCache *cache, guint msgnum)
 
        msginfo->folder->cache_dirty = TRUE;
 
 
        msginfo->folder->cache_dirty = TRUE;
 
-       procmsg_msginfo_free(msginfo);
+       procmsg_msginfo_free(&msginfo);
        cache->last_access = time(NULL);
 
 
        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);
        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);
        }
 
        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) { \
 #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; \
        } \
                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)); \
        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 \
                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);\
        }                                                                                       \
        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; \
        } \
                error = TRUE; \
                goto bail_err; \
        } \
index 8a385b6f435c0e349ad5ccf74b998e1d53eeff48..5694b0d8e6b60701339ae4e706c848a997deca29 100644 (file)
@@ -328,7 +328,7 @@ static int partial_uidl_mark_mail(MsgInfo *msginfo, int download)
        err = 0;
 bail:
        g_free(filename);
        err = 0;
 bail:
        g_free(filename);
-       procmsg_msginfo_free(tinfo);
+       procmsg_msginfo_free(&tinfo);
        
        return err;
 }
        
        return err;
 }
index 4711f4fd282bc08301e743c2afb436dfbd69c946..c1cec12152782061907b8033208410ebb39d0534 100644 (file)
@@ -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) {
        
        finalmsg = procmsg_msginfo_new_from_mimeinfo(newmsg, info);
        if (!finalmsg) {
-               procmsg_msginfo_free(newmsg);
+               procmsg_msginfo_free(&newmsg);
                return -1;
        }
 
                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;
        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);
                
        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;
        }
        
        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);
        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;
        }
 
                return;
        }
 
@@ -440,7 +440,7 @@ static void remove_attachments(GSList *msglist)
                info = procmime_scan_message(newmsg);
        
                if ( !(partinfo = find_first_text_part(info)) ) {
                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;
                        continue;
                }
                partinfo->node->next = NULL;
index e627c29dcb7f85e50f19d06169bb80613a4cb922..ad1e80d97cd47a6da02cad004bf315d204fa27d5 100644 (file)
@@ -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);
                                               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);
                   }
                           g_signal_handlers_unblock_by_func(G_OBJECT(summaryview->ctree),
                                               G_CALLBACK(block_cb), block_data);
                   }
index 266f486085f6a116f5f8170b9915b7c493cda7ad..c52a399701ff9ba484e5e1681d7fc875e9e2d8a7 100644 (file)
@@ -1053,7 +1053,7 @@ static gint vcal_remove_msg(Folder *folder, FolderItem *_item, gint num)
        if (_item == folder->inbox)
                vcal_remove_event(folder, msginfo);
 
        if (_item == folder->inbox)
                vcal_remove_event(folder, msginfo);
 
-       procmsg_msginfo_free(msginfo);
+       procmsg_msginfo_free(&msginfo);
        return 0;
 }
 
        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) {
 
        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;
                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);
        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;
        }
                folder_item_scan(folder->inbox);
                return TRUE;
        }
index 2a924e475353f45922cb071fed7b750f3572ffa6..a47f8622210069eb088cb4fcf374994d5314dfc0 100644 (file)
@@ -217,7 +217,7 @@ bail:
                        g_free(url);
                }
 
                        g_free(url);
                }
 
-               procmsg_msginfo_free(msginfo);
+               procmsg_msginfo_free(&msginfo);
        }
 
        statusbar_progress_all(0,0,0);
        }
 
        statusbar_progress_all(0,0,0);
index cce1695800896b3cf792c5893728ce915753f343..bcb3db2e32c7d15d1770ce17dead50da4e674827 100644 (file)
@@ -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);
                        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);
                        }
                }
        }
                        }
                }
        }
index 9fb33a21b54d86f1532b38f04ca025de8891661d..d47ebaf4a59e5bafe2be1f47cbcca0a29138b195 100644 (file)
@@ -84,7 +84,7 @@ void procmsg_msg_list_free(GSList *mlist)
 
        for (cur = mlist; cur != NULL; cur = cur->next) {
                msginfo = (MsgInfo *)cur->data;
 
        for (cur = mlist; cur != NULL; cur = cur->next) {
                msginfo = (MsgInfo *)cur->data;
-               procmsg_msginfo_free(msginfo);
+               procmsg_msginfo_free(&msginfo);
        }
        g_slist_free(mlist);
 }
        }
        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;
 
        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);
                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)) {
                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);
 
                                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);
                }
                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)". */
                /* 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);
        }
 
        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);
        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); 
                }       
                /* 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;
        }
 
        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);
        }
                        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);
 }
 
        return procmsg_msginfo_new_ref(msginfo);
 }
@@ -1373,8 +1373,11 @@ MsgInfo *procmsg_msginfo_get_full_info(MsgInfo *msginfo)
        return full_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--;
        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);
        }
 
                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) {
 
        if (msginfo->extradata) {
                if (msginfo->extradata->avatars) {
@@ -1407,27 +1410,28 @@ void procmsg_msginfo_free(MsgInfo *msginfo)
                                        NULL);
                        g_slist_free(msginfo->extradata->avatars);
                }
                                        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);
 
        }
        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)
 {
 
 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;
                                }
                                        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");
                        }
                        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)) {
                        if ((msginfo != NULL) && 
                            (msginfo->msgid != NULL) &&
                            (strcmp(msginfo->msgid, tokens[2]) != 0)) {
-                               procmsg_msginfo_free(msginfo);
+                               procmsg_msginfo_free(&msginfo);
                                msginfo = NULL;
                        }
                        
                                msginfo = NULL;
                        }
                        
@@ -1800,7 +1804,7 @@ send_mail:
                                }  else {
                                        procmsg_msginfo_set_flags(msginfo, MSG_FORWARDED, 0);
                                }
                                }  else {
                                        procmsg_msginfo_set_flags(msginfo, MSG_FORWARDED, 0);
                                }
-                               procmsg_msginfo_free(msginfo);
+                               procmsg_msginfo_free(&msginfo);
                        }
                }
                g_strfreev(tokens);
                        }
                }
                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)) {
                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;
                        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);
                        }
                                result = procmsg_msg_has_flagged_parent_real(
                                    tmp, perm_flags, parentmsgs);
                        }
-                       procmsg_msginfo_free(tmp);
+                       procmsg_msginfo_free(&tmp);
                        return result;
                } else {
                        return FALSE;
                        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 */
                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);
                }
        }
        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);
                }
                                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);
 }
        }
        g_slist_free(children);
 }
index 5152c05bff69cee48272a26e51b0cf40c1a1a687..9b143f1bfe687d28ebd081ef95022ff92ca52ddb 100644 (file)
@@ -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);
 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,
 guint   procmsg_msginfo_memusage       (MsgInfo        *msginfo);
 
 gint procmsg_send_message_queue_with_lock(const gchar *file,
index be2733db001974609163fac85d9be5987e839793..18f7f3a789590c8c026648e56fc5c3015611afdd 100644 (file)
@@ -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) {
                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) {
        }
 
        if (!ac_prefs->session) {
index e1914cf86d3d3413dedb450914fe4a5548420f0e..df0986e39aedd51ec15fc501eae42fa8a9a1f81f 100644 (file)
@@ -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) {
                        
                        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) {
                                        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
                                                 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
                                } 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);
                }
                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
                        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;
                }
                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)
        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,
 }
 
 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);
        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);
 
        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);
 
        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));
 
        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)
 
                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,
                } 
                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)
                        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;
        }
        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)
                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;
 
        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) {
        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);
 
        }
        g_slist_free(mlist);