sequencer: stop releasing the strbuf in write_message()
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Fri, 21 Oct 2016 12:25:41 +0000 (14:25 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 21 Oct 2016 16:32:35 +0000 (09:32 -0700)
Nothing in the name "write_message()" suggests that the function
releases the strbuf passed to it. So let's release the strbuf in the
caller instead.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c
index d74fdce99b9b9b0fbcdd3a37f85a49148515dcac..745c86f6541053014dddcb1a5774982bbbdc40f5 100644 (file)
@@ -243,7 +243,6 @@ static int write_message(struct strbuf *msgbuf, const char *filename)
                return error_errno(_("Could not lock '%s'"), filename);
        if (write_in_full(msg_fd, msgbuf->buf, msgbuf->len) < 0)
                return error_errno(_("Could not write to %s"), filename);
-       strbuf_release(msgbuf);
        if (commit_lock_file(&msg_file) < 0)
                return error(_("Error wrapping up %s."), filename);
 
@@ -759,6 +758,7 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
                free_commit_list(common);
                free_commit_list(remotes);
        }
+       strbuf_release(&msgbuf);
 
        /*
         * If the merge was clean or if it failed due to conflict, we write