Browse Source

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>
maint
Rene Scharfe 8 years ago committed by Junio C Hamano
parent
commit
11fa5e2a81
  1. 9
      mailinfo.c

9
mailinfo.c

@ -149,16 +149,14 @@ static void handle_from(struct mailinfo *mi, const struct strbuf *from)
at = strchr(f.buf, '@'); at = strchr(f.buf, '@');
if (!at) { if (!at) {
parse_bogus_from(mi, from); parse_bogus_from(mi, from);
return; goto out;
} }


/* /*
* If we already have one email, don't take any confusing lines * If we already have one email, don't take any confusing lines
*/ */
if (mi->email.len && strchr(at + 1, '@')) { if (mi->email.len && strchr(at + 1, '@'))
strbuf_release(&f); goto out;
return;
}


/* Pick up the string around '@', possibly delimited with <> /* Pick up the string around '@', possibly delimited with <>
* pair; that is the email part. * 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); get_sane_name(&mi->name, &f, &mi->email);
out:
strbuf_release(&f); strbuf_release(&f);
} }



Loading…
Cancel
Save