commit 3e2921fdee3ae350224406bb16feabeba55186f6 parent 83ce27955293d301293d7522a49e331928ff212a Author: Tomas Hlavaty <tom@logand.com> Date: Sun, 16 Jan 2011 16:04:33 +0100 flist_free fix Diffstat:
M | dirpop3d.c | | | 12 | +++++++----- |
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/dirpop3d.c b/dirpop3d.c @@ -104,11 +104,11 @@ static struct flist *flist_new(int len) { return x; } -/* static void flist_free(struct flist *x) { */ -/* for(int i = 0; i < x->n; i++) */ -/* free(x->msg[i].fname); */ -/* free(x); */ -/* } */ +static void flist_free(struct flist *x) { + for(int i = 0; i < x->n; i++) + free(x->msg[i].fname); + free(x); +} static struct flist *flist_realloc(struct flist *x, int len) { if(x->len < len) { @@ -161,6 +161,8 @@ static void pop3_handler(int fd) { struct msg *x = &flist->msg[i]; if(x->deleted) unlink(x->fname); } + flist_free(flist); + flist = NULL; } pr(fd, "+OK dirpop3d bye"); break;