Make procmsg_msginfo_free() zero out pointers to freed memory.
[claws.git] / src / partial_download.c
index 91f26003cd4f6c71d78d20bf474413746ebd7b4c..5694b0d8e6b60701339ae4e706c848a997deca29 100644 (file)
@@ -72,7 +72,6 @@ int partial_msg_in_uidl_list(MsgInfo *msginfo)
        gchar uidl[POPBUFSIZE];
        time_t recv_time;
        time_t now;
-       gint partial_recv;
        gchar *sanitized_uid = NULL;
        
        if (!msginfo->extradata)
@@ -112,7 +111,6 @@ int partial_msg_in_uidl_list(MsgInfo *msginfo)
                gchar tmp[POPBUFSIZE];
                strretchomp(buf);
                recv_time = RECV_TIME_NONE;
-               partial_recv = POP3_TOTALLY_RECEIVED;
                
                if (sscanf(buf, "%s\t%ld\t%s", uidl, (long int *) &recv_time, 
                           tmp) < 2) {
@@ -150,7 +148,7 @@ static int partial_uidl_mark_mail(MsgInfo *msginfo, int download)
 
        filename = procmsg_get_message_file_path(msginfo);
        if (!filename) {
-               g_warning("can't get message file path.\n");
+               g_warning("can't get message file path.");
                return err;
        }
        tinfo = procheader_parse_file(filename, msginfo->flags, TRUE, TRUE);
@@ -318,8 +316,11 @@ static int partial_uidl_mark_mail(MsgInfo *msginfo, int download)
        }
 
        fclose(fp);
-       claws_unlink(filename);
-       g_rename(pathnew, filename);
+       if (rename_force(pathnew, filename) != 0) {
+               g_free(pathnew);
+               goto bail;
+       }
+
        g_free(pathnew);
        msginfo->planned_download = download;
        msgcache_update_msg(msginfo->folder->cache, msginfo);
@@ -327,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;
 }
@@ -386,7 +387,6 @@ gchar *partial_get_filename(const gchar *server, const gchar *login,
        gchar uidl[POPBUFSIZE];
        time_t recv_time;
        time_t now;
-       gint partial_recv;
        gchar *sanitized_uid = g_strdup(login); 
 
        subst_for_filename(sanitized_uid);
@@ -416,7 +416,6 @@ gchar *partial_get_filename(const gchar *server, const gchar *login,
                gchar tmp[POPBUFSIZE];
                strretchomp(buf);
                recv_time = RECV_TIME_NONE;
-               partial_recv = POP3_TOTALLY_RECEIVED;
                
                if (sscanf(buf, "%s\t%ld\t%s", uidl, (long int *) &recv_time, 
                           tmp) < 2) {