Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
sequencer: release strbuf after use in save_head()
author
Rene Scharfe
<l.s.r@web.de>
Wed, 30 Aug 2017 18:20:14 +0000
(20:20 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 6 Sep 2017 23:49:28 +0000
(08:49 +0900)
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
557d318
)
diff --git
a/sequencer.c
b/sequencer.c
index fcceabb80f4261006cdd65bc0ec95ac54ea42e7c..60636ce54b615e19a22dc2396211d56540b4e920 100644
(file)
--- a/
sequencer.c
+++ b/
sequencer.c
@@
-1565,6
+1565,7
@@
static int save_head(const char *head)
static struct lock_file head_lock;
struct strbuf buf = STRBUF_INIT;
int fd;
static struct lock_file head_lock;
struct strbuf buf = STRBUF_INIT;
int fd;
+ ssize_t written;
fd = hold_lock_file_for_update(&head_lock, git_path_head_file(), 0);
if (fd < 0) {
fd = hold_lock_file_for_update(&head_lock, git_path_head_file(), 0);
if (fd < 0) {
@@
-1572,7
+1573,9
@@
static int save_head(const char *head)
return error_errno(_("could not lock HEAD"));
}
strbuf_addf(&buf, "%s\n", head);
return error_errno(_("could not lock HEAD"));
}
strbuf_addf(&buf, "%s\n", head);
- if (write_in_full(fd, buf.buf, buf.len) < 0) {
+ written = write_in_full(fd, buf.buf, buf.len);
+ strbuf_release(&buf);
+ if (written < 0) {
rollback_lock_file(&head_lock);
return error_errno(_("could not write to '%s'"),
git_path_head_file());
rollback_lock_file(&head_lock);
return error_errno(_("could not write to '%s'"),
git_path_head_file());