Merge branch 'tj/maint-imap-send-remove-unused'
[gitweb.git] / builtin / fmt-merge-msg.c
index ed95349b424f2f3d2aa671a277b346ae6198d34c..bdfa0ea05d99089937b9e753cf85a8489a5e27cb 100644 (file)
@@ -379,6 +379,7 @@ int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
                die("No current branch");
        if (!prefixcmp(current_branch, "refs/heads/"))
                current_branch += 11;
+       current_branch = xstrdup(current_branch);
 
        /* get a line */
        while (pos < in->len) {
@@ -420,6 +421,7 @@ int fmt_merge_msg(struct strbuf *in, struct strbuf *out,
        }
 
        strbuf_complete_line(out);
+       free((char *)current_branch);
        return 0;
 }