From 11fa5e2a81cc921b55a4a91f2e5f39d423f18467 Mon Sep 17 00:00:00 2001 From: Rene Scharfe Date: Wed, 30 Aug 2017 19:49:47 +0200 Subject: 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 --- mailinfo.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'mailinfo.c') 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); } -- cgit v1.2.3