summaryrefslogtreecommitdiffstats
path: root/compress.h
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2016-11-13 20:02:34 -0800
committerKevin McCarthy <kevin@8t8.us>2016-11-13 20:02:34 -0800
commit203c84f949fdb588b9069956ad67e88d7f2ca142 (patch)
treef560cb4aca4606e4c3e762e5fae4fe50ded37e71 /compress.h
parent4c96c9496129422768f8a2b9da7e79c34b07870b (diff)
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.
Diffstat (limited to 'compress.h')
-rw-r--r--compress.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/compress.h b/compress.h
index e41fe93e..f525c70b 100644
--- a/compress.h
+++ b/compress.h
@@ -19,6 +19,8 @@
#ifndef _COMPRESS_H_
#define _COMPRESS_H_
+void mutt_free_compress_info (CONTEXT *ctx);
+
int mutt_comp_can_append (CONTEXT *ctx);
int mutt_comp_can_read (const char *path);
int mutt_comp_sync (CONTEXT *ctx);