The main focus of this patch set was removing unneeded hdr->env NULL
checks in a few places.  This has been on my TODO list for a while.  I
don't like to see those tests unless there is a good reason, and I
suspected they were "voodoo" safety checks.

So I've spent some time tracing through the header and header->env
lifecycles to check if this was possible.

While doing that I noticed a couple minor error-path memory leaks, so
I created the first patch.

After reviewing and finding (almost) no cases hdr without an env is
released into the rest of the code, I removed the various checks in
the second patch.  There was one exception: for resuming a postponed
messaged in main.c, and so I commented that case.

The toughest part of the code to review was the mh.c maildir/mh
parsing.  After I finished that, I found maildir_delayed_parsing() was
overly complicated and difficult to read because of that.  The third
patch cleans up the loop, moving sorting to the top and getting rid of
unneeded code.

After the clean up, I found an entry in the maildir structure isn't
actually used anywhere else, so I removed it in patch four.

Kevin J. McCarthy (4):
  Fix memory leaks on error in main() and mmdf_parse_mailbox().
  Remove unneeded header->env checks.
  Simplify maildir_delayed_parsing().
  Remove maildir header_parsed bit.

 copy.c      |  9 +++---
 imap/imap.c | 12 ++------
 main.c      |  2 ++
 mbox.c      |  5 +++-
 mh.c        | 80 ++++++++---------------------------------------------
 postpone.c  |  7 +++--
 6 files changed, 30 insertions(+), 85 deletions(-)

-- 
2.55.0

Reply via email to