From fe19686448089ceda89f416376f7a103e4465660 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Fri, 12 Aug 2016 13:59:02 +1000 Subject: [PATCH] Fix message invalid free --- mail_menu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mail_menu.c b/mail_menu.c index 762ae68..128377f 100644 --- a/mail_menu.c +++ b/mail_menu.c @@ -82,8 +82,10 @@ void free_message_headers(struct msg_headers *msghs) { if (msghs->msgs[i]->replyid != NULL) { free(msghs->msgs[i]->replyid); } - } - free(msghs->msgs); + } + if (msghs->msg_count > 0) { + free(msghs->msgs); + } free(msghs); }