commit 4fb50e25a7d48039111602e17b884de6ce75213e
parent 98101ebd1a3f11c59513abfe3af1ff56c19576ec
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date: Sun, 14 May 2023 15:29:00 +0000
Fix memory leak in pop_list
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/pop3.c b/pop3.c
@@ -1,4 +1,4 @@
-/* $Id: pop3.c,v 1.14 2023/05/14 05:59:47 jacob Exp $ */
+/* $Id: pop3.c,v 1.15 2023/05/14 15:29:00 jacob Exp $ */
/*
* Copyright (c) 2022, 2023 Jacob R. Edwards <jacob@jacobedwards.org>
@@ -331,8 +331,10 @@ pop_list(FILE *fp, int *_len)
return listings;
}
- if (!pop_okay(pop_comd(fp, buf, sizeof(buf), "LIST", NULL)))
+ if (!pop_okay(pop_comd(fp, buf, sizeof(buf), "LIST", NULL))) {
+ free(listings);
return NULL;
+ }
for (i = 0; i < len && pop_read(fp, buf, sizeof(buf)) &&
strcmp(buf, ".") != 0; ++i) {