]> granicus.if.org Git - neomutt/commitdiff
fix leak in mutt_attach_mail_sender()
authorRichard Russon <rich@flatcap.org>
Thu, 19 Sep 2019 22:29:12 +0000 (23:29 +0100)
committerRichard Russon <rich@flatcap.org>
Sat, 21 Sep 2019 17:09:06 +0000 (18:09 +0100)
recvcmd.c

index 37e39a152721d0775e15930c7e29e88c7247c87b..8ee1e734e6324b1b42c81e46f4bd71e941869aec 100644 (file)
--- a/recvcmd.c
+++ b/recvcmd.c
@@ -1073,7 +1073,10 @@ void mutt_attach_mail_sender(FILE *fp, struct Email *e, struct AttachCtx *actx,
   if (cur)
   {
     if (mutt_fetch_recips(e_tmp->env, cur->email->env, SEND_TO_SENDER) == -1)
+    {
+      email_free(&e_tmp);
       return;
+    }
   }
   else
   {
@@ -1082,8 +1085,13 @@ void mutt_attach_mail_sender(FILE *fp, struct Email *e, struct AttachCtx *actx,
       if (actx->idx[i]->content->tagged &&
           (mutt_fetch_recips(e_tmp->env, actx->idx[i]->content->email->env,
                              SEND_TO_SENDER) == -1))
+      {
+        email_free(&e_tmp);
         return;
+      }
     }
   }
+
+  // This call will free e_tmp for us
   ci_send_message(SEND_NO_FLAGS, e_tmp, NULL, NULL, NULL);
 }