summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2017-10-15 20:33:18 +0300
committerSergey Poznyakoff <gray@gnu.org>2017-10-15 20:33:18 +0300
commit9c45fbd40c00a8e5d63c5b47dbed7da6b216e19f (patch)
tree473645380ebadf6d22a45e8d62244dd9fb900fed
parent0f64ae426fdf0b7fbbcbdfa952bebf4012f3ff17 (diff)
downloadmailutils-9c45fbd40c00a8e5d63c5b47dbed7da6b216e19f.tar.gz
mailutils-9c45fbd40c00a8e5d63c5b47dbed7da6b216e19f.tar.bz2
Fix memory leaks in amd and assoc.
-rw-r--r--libmailutils/base/amd.c5
-rw-r--r--libmailutils/base/assoc.c1
-rw-r--r--libproto/maildir/mbox.c3
3 files changed, 8 insertions, 1 deletions
diff --git a/libmailutils/base/amd.c b/libmailutils/base/amd.c
index 43267e9d4..34ccfc0d4 100644
--- a/libmailutils/base/amd.c
+++ b/libmailutils/base/amd.c
@@ -442,6 +442,8 @@ amd_destroy (mu_mailbox_t mailbox)
for (i = 0; i < amd->msg_count; i++)
{
mu_message_destroy (&amd->msg_array[i]->message, amd->msg_array[i]);
+ if (amd->msg_free)
+ amd->msg_free (amd->msg_array[i]);
free (amd->msg_array[i]);
}
free (amd->msg_array);
@@ -514,6 +516,8 @@ amd_close (mu_mailbox_t mailbox)
for (i = 0; i < amd->msg_count; i++)
{
mu_message_destroy (&amd->msg_array[i]->message, amd->msg_array[i]);
+ if (amd->msg_free)
+ amd->msg_free (amd->msg_array[i]);
free (amd->msg_array[i]);
}
free (amd->msg_array);
@@ -2210,6 +2214,7 @@ amd_envelope_sender (mu_envelope_t envelope, char *buf, size_t len, size_t *psiz
if (psize)
*psize = len;
+ free (from);
return 0;
}
diff --git a/libmailutils/base/assoc.c b/libmailutils/base/assoc.c
index a597ca47c..a1c2d6c46 100644
--- a/libmailutils/base/assoc.c
+++ b/libmailutils/base/assoc.c
@@ -156,6 +156,7 @@ assoc_free_elem (mu_assoc_t assoc, unsigned idx)
assoc->free (assoc->tab[idx]->data);
if (!(assoc->flags & MU_ASSOC_COPY_KEY))
free (assoc->tab[idx]->name);
+ free (assoc->tab[idx]);
assoc->tab[idx] = NULL;
}
}
diff --git a/libproto/maildir/mbox.c b/libproto/maildir/mbox.c
index 7fc0ac6c3..ed34887d7 100644
--- a/libproto/maildir/mbox.c
+++ b/libproto/maildir/mbox.c
@@ -360,7 +360,8 @@ static void
maildir_msg_free (struct _amd_message *amsg)
{
struct _maildir_message *mp = (struct _maildir_message *) amsg;
- free (mp->file_name);
+ if (mp)
+ free (mp->file_name);
}
static int

Return to:

Send suggestions and report system problems to the System administrator.