diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-02-14 00:39:14 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-02-14 00:39:14 +0300 |
commit | 46e915c42bdef79caf65ebdd26ee39aa0c011ebc (patch) | |
tree | 356f37630a97bb80a241cefe89a85707f1c0da72 /mailinfo.c | |
parent | cbf0240f82fc6b7072c7d18fa56caace4902a44b (diff) | |
parent | 4e801463c7d2b26de747d3684cf75b722b0594af (diff) |
Merge branch 'jc/mailinfo-cleanup-fix'
Corner case bugfix.
* jc/mailinfo-cleanup-fix:
mailinfo: avoid segfault when can't open files
Diffstat (limited to 'mailinfo.c')
-rw-r--r-- | mailinfo.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/mailinfo.c b/mailinfo.c index a89db22ab0c..d04142ccc76 100644 --- a/mailinfo.c +++ b/mailinfo.c @@ -1167,11 +1167,13 @@ void clear_mailinfo(struct mailinfo *mi) strbuf_release(&mi->inbody_header_accum); free(mi->message_id); - for (i = 0; mi->p_hdr_data[i]; i++) - strbuf_release(mi->p_hdr_data[i]); + if (mi->p_hdr_data) + for (i = 0; mi->p_hdr_data[i]; i++) + strbuf_release(mi->p_hdr_data[i]); free(mi->p_hdr_data); - for (i = 0; mi->s_hdr_data[i]; i++) - strbuf_release(mi->s_hdr_data[i]); + if (mi->s_hdr_data) + for (i = 0; mi->s_hdr_data[i]; i++) + strbuf_release(mi->s_hdr_data[i]); free(mi->s_hdr_data); while (mi->content < mi->content_top) { |