diff options
author | Rene Scharfe <l.s.r@web.de> | 2017-08-30 19:49:47 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-09-07 08:49:27 +0900 |
commit | 11fa5e2a81cc921b55a4a91f2e5f39d423f18467 (patch) | |
tree | 5b147842a66af339f0e678ed22dcb4364b61afb8 | |
parent | help: release strbuf on error return in exec_woman_emacs() (diff) | |
download | tgif-11fa5e2a81cc921b55a4a91f2e5f39d423f18467.tar.xz |
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>
-rw-r--r-- | mailinfo.c | 9 |
1 files changed, 4 insertions, 5 deletions
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); } |