From: Rene Scharfe Date: Wed, 30 Aug 2017 17:49:47 +0000 (+0200) Subject: mailinfo: release strbuf after use in handle_from() X-Git-Tag: v2.15.0-rc0~78^2~18 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/11fa5e2a81cc921b55a4a91f2e5f39d423f18467?ds=inline 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 Signed-off-by: Junio C Hamano --- diff --git a/mailinfo.c b/mailinfo.c index bd574cb752..b1f5159546 100644 --- a/mailinfo.c +++ b/mailinfo.c @@ -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); }