Merge branch 'jc/mailinfo-cleanup-fix' into maint

Corner case bugfix.

* jc/mailinfo-cleanup-fix:
  mailinfo: avoid segfault when can't open files
This commit is contained in:
Junio C Hamano 2018-03-22 14:24:16 -07:00
commit bffce882fd

View File

@ -1167,11 +1167,13 @@ void clear_mailinfo(struct mailinfo *mi)
strbuf_release(&mi->inbody_header_accum); strbuf_release(&mi->inbody_header_accum);
free(mi->message_id); free(mi->message_id);
for (i = 0; mi->p_hdr_data[i]; i++) if (mi->p_hdr_data)
strbuf_release(mi->p_hdr_data[i]); for (i = 0; mi->p_hdr_data[i]; i++)
strbuf_release(mi->p_hdr_data[i]);
free(mi->p_hdr_data); free(mi->p_hdr_data);
for (i = 0; mi->s_hdr_data[i]; i++) if (mi->s_hdr_data)
strbuf_release(mi->s_hdr_data[i]); for (i = 0; mi->s_hdr_data[i]; i++)
strbuf_release(mi->s_hdr_data[i]);
free(mi->s_hdr_data); free(mi->s_hdr_data);
while (mi->content < mi->content_top) { while (mi->content < mi->content_top) {