am: release strbufs after use in detect_patch_format()

Don't reset the strbufs l2 and l3 before use as if they were static, but release them at the end instead. 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 542627a4f79ffe1c21e759508ee3c6c4f1211be6
1 file changed +2 -2
builtin/am.c
+2 -2
@@ -671,9 +671,7 @@ static int detect_patch_format(const char **paths)
671 goto done;
672 }
673
674 - strbuf_reset(&l2);
674 strbuf_getline(&l2, fp);
676 - strbuf_reset(&l3);
675 strbuf_getline(&l3, fp);
676
677 /*
@@ -696,6 +694,8 @@ static int detect_patch_format(const char **paths)
694 done:
695 fclose(fp);
696 strbuf_release(&l1);
697 + strbuf_release(&l2);
698 + strbuf_release(&l3);
699 return ret;
700 }
701