mailinfo: release strbuf after use in handle_from()

Clean up at the end and jump there instead of returning early.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Rene Scharfe 2017-08-30 19:49:47 +02:00 committed by Junio C Hamano
parent bad0e2c6a8
commit 11fa5e2a81

View File

@ -149,16 +149,14 @@ static void handle_from(struct mailinfo *mi, const struct strbuf *from)
at = strchr(f.buf, '@');
if (!at) {
parse_bogus_from(mi, from);
return;
goto out;
}
/*
* If we already have one email, don't take any confusing lines
*/
if (mi->email.len && strchr(at + 1, '@')) {
strbuf_release(&f);
return;
}
if (mi->email.len && strchr(at + 1, '@'))
goto out;
/* Pick up the string around '@', possibly delimited with <>
* pair; that is the email part.
@ -198,6 +196,7 @@ static void handle_from(struct mailinfo *mi, const struct strbuf *from)
}
get_sane_name(&mi->name, &f, &mi->email);
out:
strbuf_release(&f);
}