From: Rene Scharfe Date: Wed, 30 Aug 2017 17:49:32 +0000 (+0200) Subject: am: release strbufs after use in detect_patch_format() X-Git-Tag: v2.15.0-rc0~78^2~33 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/542627a4f79ffe1c21e759508ee3c6c4f1211be6?ds=inline 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 Signed-off-by: Junio C Hamano --- diff --git a/builtin/am.c b/builtin/am.c index c369dd1dce..3c50b03faa 100644 --- a/builtin/am.c +++ b/builtin/am.c @@ -671,9 +671,7 @@ static int detect_patch_format(const char **paths) goto done; } - strbuf_reset(&l2); strbuf_getline(&l2, fp); - strbuf_reset(&l3); strbuf_getline(&l3, fp); /* @@ -696,6 +694,8 @@ static int detect_patch_format(const char **paths) done: fclose(fp); strbuf_release(&l1); + strbuf_release(&l2); + strbuf_release(&l3); return ret; }