summaryrefslogtreecommitdiff
path: root/mailinfo.c
diff options
context:
space:
mode:
authorRene Scharfe <l.s.r@web.de>2017-08-30 19:49:47 +0200
committerJunio C Hamano <gitster@pobox.com>2017-09-07 08:49:27 +0900
commit11fa5e2a81cc921b55a4a91f2e5f39d423f18467 (patch)
tree5b147842a66af339f0e678ed22dcb4364b61afb8 /mailinfo.c
parentbad0e2c6a89b52b0d6b2ebae6e290b6d4e6f799c (diff)
downloadgit-11fa5e2a81cc921b55a4a91f2e5f39d423f18467.tar.gz
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>
Diffstat (limited to 'mailinfo.c')
-rw-r--r--mailinfo.c9
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);
}