summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlain Magloire <alainm@gnu.org>2004-06-21 03:19:58 +0000
committerAlain Magloire <alainm@gnu.org>2004-06-21 03:19:58 +0000
commitf5532b4a7485a2c098a367917952a7518de8d408 (patch)
tree523b21db11681d16c2ea2212d00158477448362f
parentae5a9652942a312261ec748b5e9920a6055d73c9 (diff)
downloadmailutils-f5532b4a7485a2c098a367917952a7518de8d408.tar.gz
mailutils-f5532b4a7485a2c098a367917952a7518de8d408.tar.bz2
* mailbox/pop/pop3_lista.c: Destroy the list on error.
* mailbox/pop/pop3_uidla.c: Destroy the list on error.
-rw-r--r--mailbox/pop/pop3_lista.c12
-rw-r--r--mailbox/pop/pop3_uidla.c12
2 files changed, 19 insertions, 5 deletions
diff --git a/mailbox/pop/pop3_lista.c b/mailbox/pop/pop3_lista.c
index 0039081a7..94464f055 100644
--- a/mailbox/pop/pop3_lista.c
+++ b/mailbox/pop/pop3_lista.c
@@ -1,5 +1,5 @@
/* GNU Mailutils -- a suite of utilities for electronic mail
- Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2004 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -65,12 +65,18 @@ mu_pop3_list_all (mu_pop3_t pop3, list_t *plist)
But do not use the stack and malloc. */
char *lista;
size_t n = 0;
-
+
lista = malloc (512);
if (lista == NULL)
{
- MU_POP3_CHECK_ERROR(pop3, ENOMEM);
+ /* MU_POP3_CHECK_ERROR(pop3, ENOMEM);
+ Do not use the macro we need to clear the list if errors. */
+ pop3->io.ptr = pop3->io.buf;
+ pop3->state = MU_POP3_ERROR;
+ list_destroy (plist);
+ return ENOMEM;
}
+
while ((status = mu_pop3_readline (pop3, lista, 512, &n)) == 0 && n > 0)
{
/* Nuke the trailing newline */
diff --git a/mailbox/pop/pop3_uidla.c b/mailbox/pop/pop3_uidla.c
index 73ba56b97..38acd397f 100644
--- a/mailbox/pop/pop3_uidla.c
+++ b/mailbox/pop/pop3_uidla.c
@@ -64,12 +64,20 @@ mu_pop3_uidl_all (mu_pop3_t pop3, list_t *plist)
But do not use the stack and malloc. */
char *uidla;
size_t n = 0;
-
+
uidla = malloc (512);
if (uidla == NULL)
{
- MU_POP3_CHECK_ERROR(pop3, ENOMEM);
+ /* MU_POP3_CHECK_ERROR(pop3, ENOMEM)
+ Do not use the macro since we have to remove the list
+ if things go wrong.
+ */
+ pop3->io.ptr = pop3->io.buf;
+ pop3->state = MU_POP3_ERROR;
+ list_destroy (plist);
+ return ENOMEM;
}
+
while ((status = mu_pop3_readline (pop3, uidla, 512, &n)) == 0 && n > 0)
{
/* Nuke the trailing newline */

Return to:

Send suggestions and report system problems to the System administrator.