mailinfo: avoid segfault when can't open files
commit4e801463c7d2b26de747d3684cf75b722b0594af
authorJuan F. Codagnone <jcodagnone@gmail.com>
Wed, 24 Jan 2018 16:56:47 +0000 (24 13:56 -0300)
committerJunio C Hamano <gitster@pobox.com>
Wed, 24 Jan 2018 18:52:26 +0000 (24 10:52 -0800)
tree2704f8dfc3229d531420a854fd43098a8e8d01f0
parent9752ad0bb79f680bca48db7adc45338b298304b0
mailinfo: avoid segfault when can't open files

If <msg> or <patch> files can't be opened, then mailinfo() returns an
error before it even initializes mi->p_hdr_data or mi->s_hdr_data.
When cmd_mailinfo() then calls clear_mailinfo(), we dereference the
NULL pointers trying to free their contents.

Signed-off-by: Juan F. Codagnone <jcodagnone@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
mailinfo.c