amd_expunge): Unlink the message file if msg_file_name returns NULL.
Showing
1 changed file
with
11 additions
and
6 deletions
... | @@ -820,13 +820,18 @@ amd_expunge (mailbox_t mailbox) | ... | @@ -820,13 +820,18 @@ amd_expunge (mailbox_t mailbox) |
820 | { | 820 | { |
821 | if (!mhm->deleted) | 821 | if (!mhm->deleted) |
822 | { | 822 | { |
823 | char *old_name, *new_name; | 823 | char *old_name = amd->msg_file_name (mhm, 0); |
824 | /* Rename original message */ | 824 | char *new_name = amd->msg_file_name (mhm, 1); |
825 | old_name = amd->msg_file_name (mhm, 0); | 825 | if (new_name) |
826 | new_name = amd->msg_file_name (mhm, 1); | 826 | { |
827 | rename (old_name, new_name); | 827 | /* Rename original message */ |
828 | rename (old_name, new_name); | ||
829 | free (new_name); | ||
830 | } | ||
831 | else | ||
832 | /* Unlink original file */ | ||
833 | unlink (old_name); | ||
828 | free (old_name); | 834 | free (old_name); |
829 | free (new_name); | ||
830 | } | 835 | } |
831 | _amd_message_delete (amd, mhm); | 836 | _amd_message_delete (amd, mhm); |
832 | /* Do not increase i! */ | 837 | /* Do not increase i! */ | ... | ... |
-
Please register or sign in to post a comment