]> granicus.if.org Git - neomutt/commit
Compress: fix several logic and memory bugs.
authorKevin McCarthy <kevin@8t8.us>
Mon, 14 Nov 2016 04:02:34 +0000 (20:02 -0800)
committerRichard Russon <rich@flatcap.org>
Fri, 18 Nov 2016 15:13:48 +0000 (15:13 +0000)
commit0b799a6b04527c7f0690b22221bdd7179cae6eb8
treefc931e18aab89b0d2284b0f8bf287380337fc6e0
parentd273f8c1e5e1eb8695d26d1b6ce55b15a7f0a01a
Compress: fix several logic and memory bugs.

setup_paths leaks memory: realpath is already set in mx_open_mailbox()

restore_paths is unneeded.  mx_fastclose_mailbox() will free stuff,
and nothing is looking at the path once we are closing or aborting.

Make a copy of the hooks.  Otherwise 'unhook *' will leave dangling
pointers.

Add compress_info freeing inside mx_fastclose_mailbox().  Only free
inside compress.c when we want to prevent close() from doing anything.

close_mailbox() didn't preserve ctx->path on error.

execute_command() didn't return an error if the mutt_system() command
failed.

mx_open_mailbox_append() should check mutt_comp_can_append() only for
the case that the mailbox doesn't exist.  When it exists,
mx_get_magic() has already looked at the file contents before checking
for matching open_hooks.

In open_append_mailbox() if no append hook is defined, it should't
call ci->open() if the mailbox doesn't exist.  It should act just like
append and create a temporary file.

check_mailbox() needs more work.  For now, at least have it properly
close the mailbox on error.
compress.c
compress.h
mx.c