Re: [PATCH 2/7] sequencer: release a strbuf used in save_head()
- From
Ramkumar Ramachandra <artagnon@gmail.com>
- Date
- May 22, 2012, 04:12 UTC
- Message-ID
- <CALkWK0m9F6EU43v0HbJxWUVtHTiw+ZvjCjwqbSVdQfomb6f4Aw@mail.gmail.com>
- In-Reply-To
- <20120521145610.1911.61154.chriscool@tuxfamily.org>
Hi Christian,
Christian Couder wrote:
Show 12 quoted lines
> diff --git a/sequencer.c b/sequencer.c
> index 762c527..ad1bbea 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -741,6 +741,7 @@ static void save_head(const char *head)
> die_errno(_("Could not write to %s"), head_file);
> if (commit_lock_file(&head_lock) < 0)
> die(_("Error wrapping up %s."), head_file);
> + strbuf_release(&buf);
> }
>
> static int reset_for_rollback(const unsigned char *sha1)Thanks. Shouldn't we be polluting the die() pathways with this strbuf_release(&buf) the way save_todo() does it consistently?
if (write_in_full(fd, buf.buf, buf.len) < 0) {
strbuf_release(&buf);
die_errno(_("Could not write to %s"), todo_file);
}
if (commit_lock_file(&todo_lock) < 0) {
strbuf_release(&buf);
die(_("Error wrapping up %s."), todo_file);
}
strbuf_release(&buf);Ram