ATTACH_CONTEXT *actx, BODY * cur)
{
HEADER *curhdr = NULL;
- HEADER *tmphdr;
+ HEADER *tmphdr = NULL;
short i;
int rc;
BODY **last;
- char tmpbody[_POSIX_PATH_MAX];
+ BUFFER *tmpbody = NULL;
FILE *tmpfp = NULL;
int cmflags = 0;
mutt_make_forward_subject (tmphdr->env, Context, curhdr);
- tmpbody[0] = '\0';
+ tmpbody = mutt_buffer_pool_get ();
if ((rc = query_quadoption (OPT_MIMEFWD,
_("Forward MIME encapsulated?"))) == MUTT_NO)
/* no MIME encapsulation */
- mutt_mktemp (tmpbody, sizeof (tmpbody));
- if (!(tmpfp = safe_fopen (tmpbody, "w")))
+ mutt_buffer_mktemp (tmpbody);
+ if (!(tmpfp = safe_fopen (mutt_b2s (tmpbody), "w")))
{
- mutt_error (_("Can't create %s."), tmpbody);
- mutt_free_header (&tmphdr);
- return;
+ mutt_error (_("Can't create %s."), mutt_b2s (tmpbody));
+ goto cleanup;
}
if (option (OPTFORWQUOTE))
else
mutt_free_header (&tmphdr);
- ci_send_message (0, tmphdr, *tmpbody ? tmpbody : NULL,
+ ci_send_message (0, tmphdr,
+ mutt_buffer_len (tmpbody) ? mutt_b2s (tmpbody) : NULL,
NULL, curhdr);
+ tmphdr = NULL; /* ci_send_message frees this */
+cleanup:
+ mutt_free_header (&tmphdr);
+ mutt_buffer_pool_release (&tmpbody);
}
void mutt_attach_forward (FILE * fp, HEADER * hdr,