summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2021-11-19 08:04:10 +0200
committerSergey Poznyakoff <gray@gnu.org>2021-11-19 08:04:10 +0200
commit8d195a093d55ac81ba743c14990694e5815b05c3 (patch)
tree4fa6fda1f6933083b725789ef5d555a8d90c8bd2
parent805a3f8343f30a10056810f0fec4f0672dd3c297 (diff)
downloadmailutils-8d195a093d55ac81ba743c14990694e5815b05c3.tar.gz
mailutils-8d195a093d55ac81ba743c14990694e5815b05c3.tar.bz2
Fix memory and fd leak in maildir and amd
* libmailutils/base/amd.c (amd_expunge): Close and destroy the associated message stream. * libproto/maildir/maildir.c (maildir_close): Fix erroneously reverted condition.
-rw-r--r--libmailutils/base/amd.c1
-rw-r--r--libproto/maildir/maildir.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/libmailutils/base/amd.c b/libmailutils/base/amd.c
index e488da153..2515caa4a 100644
--- a/libmailutils/base/amd.c
+++ b/libmailutils/base/amd.c
@@ -1386,6 +1386,7 @@ amd_expunge (mu_mailbox_t mailbox)
pp = amd_pool_lookup (mhm);
if (pp)
*pp = NULL;
+ amd_message_stream_close (mhm);
mu_message_destroy (&mhm->message, mhm);
if (amd->msg_free)
amd->msg_free (mhm);
diff --git a/libproto/maildir/maildir.c b/libproto/maildir/maildir.c
index 25aa44834..6a6d08c7e 100644
--- a/libproto/maildir/maildir.c
+++ b/libproto/maildir/maildir.c
@@ -513,7 +513,7 @@ maildir_open (struct _maildir_data *md)
static void
maildir_close (struct _maildir_data *md)
{
- if (md->folder_fd == -1)
+ if (md->folder_fd != -1)
{
close (md->folder_fd);
md->folder_fd = -1;

Return to:

Send suggestions and report system problems to the System administrator.