From: Kevin McCarthy Date: Sat, 22 Jun 2019 23:13:46 +0000 (-0700) Subject: Add NULL checks to rfc1524_free_entry(). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5e49cbf2cb535df39517852b0b528f84af9c6bc9;p=mutt Add NULL checks to rfc1524_free_entry(). The existing code was fine, but make it robust like other free functions in mutt, so the behavior isn't surprising. --- diff --git a/attach.c b/attach.c index db0d806f..de58b553 100644 --- a/attach.c +++ b/attach.c @@ -601,8 +601,7 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr, return_error: - if (entry) - rfc1524_free_entry (&entry); + rfc1524_free_entry (&entry); if (fp && (mutt_b2s (tempfile))[0]) mutt_unlink (mutt_b2s (tempfile)); else if (unlink_tempfile) diff --git a/rfc1524.c b/rfc1524.c index 8ed8c95c..50ff8469 100644 --- a/rfc1524.c +++ b/rfc1524.c @@ -398,8 +398,12 @@ rfc1524_entry *rfc1524_new_entry(void) void rfc1524_free_entry(rfc1524_entry **entry) { - rfc1524_entry *p = *entry; + rfc1524_entry *p; + if (!entry || !*entry) + return; + + p = *entry; FREE (&p->command); FREE (&p->testcommand); FREE (&p->composecommand);