aboutsummaryrefslogtreecommitdiffstats
path: root/imap.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1996-10-26 13:21:21 +0000
committerEric S. Raymond <esr@thyrsus.com>1996-10-26 13:21:21 +0000
commitd59e69783b91feb5d3ee5d2ba802c279ecf021c5 (patch)
tree3757e936897981afc9136dd3cff7cf8981a3d89a /imap.c
parente700d27f62f10357b82737d8086982b31f5aa652 (diff)
downloadfetchmail-d59e69783b91feb5d3ee5d2ba802c279ecf021c5.tar.gz
fetchmail-d59e69783b91feb5d3ee5d2ba802c279ecf021c5.tar.bz2
fetchmail-d59e69783b91feb5d3ee5d2ba802c279ecf021c5.zip
Include mx.h, fix a memory leak.
svn path=/trunk/; revision=395
Diffstat (limited to 'imap.c')
-rw-r--r--imap.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/imap.c b/imap.c
index 286d469c..fbacc3cb 100644
--- a/imap.c
+++ b/imap.c
@@ -111,39 +111,34 @@ int *countp, *newp;
return(0);
}
-static int *imap_getsizes(socket, count)
+static int imap_getsizes(socket, count, sizes)
/* capture the sizes of all messages */
int socket;
int count;
+int *sizes;
{
- int ok, *sizes;
+ char buf [POPBUFSIZE+1];
- if ((sizes = (int *)malloc(sizeof(int) * count)) == (int *)NULL)
- return((int *)NULL);
- else
+ gen_send(socket, "FETCH 1:%d RFC822.SIZE", count);
+ while (SockGets(socket, buf, sizeof(buf)) >= 0)
{
- char buf [POPBUFSIZE+1];
-
- gen_send(socket, "FETCH 1:%d RFC822.SIZE", count);
- while (SockGets(socket, buf, sizeof(buf)) >= 0)
- {
- int num, size;
-
- if (outlevel == O_VERBOSE)
- fprintf(stderr,"%s\n",buf);
- if (strstr(buf, "OK"))
- break;
- else if (sscanf(buf, "* %d FETCH (RFC822.SIZE %d)", &num, &size) == 2)
- sizes[num - 1] = size;
- else
- sizes[num - 1] = -1;
- }
+ int num, size;
- return(sizes);
+ if (outlevel == O_VERBOSE)
+ fprintf(stderr,"%s\n",buf);
+ if (strstr(buf, "OK"))
+ break;
+ else if (sscanf(buf, "* %d FETCH (RFC822.SIZE %d)", &num, &size) == 2)
+ sizes[num - 1] = size;
+ else
+ sizes[num - 1] = -1;
}
+
+ return(0);
}
static imap_is_old(socket, ctl, num)
+/* is the given message old? */
int socket;
struct query *ctl;
int num;
@@ -182,7 +177,7 @@ int *lenp;
}
static imap_trail(socket, ctl, number)
-/* discard tail of FETCH response */
+/* discard tail of FETCH response after reading message text */
int socket;
struct query *ctl;
int number;