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>
Rene Scharfe committed
Aug 30, 2017 at 19:49 UTC
11fa5e2a81cc921b55a4a91f2e5f39d423f18467
1 file changed
+4
-5
mailinfo.c
+4
-5
@@ -149,16 +149,14 @@ static void handle_from(struct mailinfo *mi, const struct strbuf *from)
149
at = strchr(f.buf, '@');
150
if (!at) {
151
parse_bogus_from(mi, from);
152
- return;
152
+ goto out;
153
}
154
155
/*
156
* If we already have one email, don't take any confusing lines
157
*/
158
- if (mi->email.len && strchr(at + 1, '@')) {
159
- strbuf_release(&f);
160
- return;
161
- }
158
+ if (mi->email.len && strchr(at + 1, '@'))
159
+ goto out;
160
161
/* Pick up the string around '@', possibly delimited with <>
162
* pair; that is the email part.
@@ -198,6 +196,7 @@ static void handle_from(struct mailinfo *mi, const struct strbuf *from)
196
}
197
198
get_sane_name(&mi->name, &f, &mi->email);
199
+out:
200
strbuf_release(&f);
201
}
202