Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> --- builtin/fmt-merge-msg.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c index c80f4b7..3d001d4 100644 --- a/builtin/fmt-merge-msg.c +++ b/builtin/fmt-merge-msg.c @@ -261,9 +261,10 @@ static int do_fmt_merge_msg(int merge_title, struct strbuf *in, int i = 0, pos = 0; unsigned char head_sha1[20]; const char *current_branch; + char *ref; /* get current branch */ - current_branch = resolve_ref("HEAD", head_sha1, 1, NULL, 0); + current_branch = ref = resolve_ref("HEAD", head_sha1, 1, NULL, 1); if (!current_branch) die("No current branch"); if (!prefixcmp(current_branch, "refs/heads/")) @@ -283,8 +284,10 @@ static int do_fmt_merge_msg(int merge_title, struct strbuf *in, die ("Error in line %d: %.*s", i, len, p); } - if (!srcs.nr) + if (!srcs.nr) { + free(ref); return 0; + } if (merge_title) do_fmt_merge_msg_title(out, current_branch); @@ -306,6 +309,7 @@ static int do_fmt_merge_msg(int merge_title, struct strbuf *in, shortlog(origins.items[i].string, origins.items[i].util, head, &rev, shortlog_len, out); } + free(ref); return 0; } -- 1.7.4.74.g639db -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html