From b97eff4dbe1f19d1bc2e2435cf2bbb4fb3b87526 Mon Sep 17 00:00:00 2001 From: Mithil Poojary Date: Sat, 3 Oct 2020 03:30:14 +0530 Subject: [PATCH] Fix order of freeing memory --- src/mboxscan.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mboxscan.cc b/src/mboxscan.cc index d90cdce0..e353060c 100644 --- a/src/mboxscan.cc +++ b/src/mboxscan.cc @@ -350,11 +350,11 @@ static void mbox_scan(char *args, char *output, size_t max_len) { } strncat(output, buf, max_len - strlen(output)); - tmp = curr; - curr = curr->previous; - free(tmp->from); - free(tmp->subject); - free(tmp); + tmp = curr->previous; + free(curr->from); + free(curr->subject); + free(curr); + curr = tmp; i--; }