Skip to content

Commit e505146

Browse files
rscharfegitster
authored andcommitted
commit: release strbuf on error return in commit_tree_extended()
Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 9c18b54 commit e505146

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

commit.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1564,10 +1564,13 @@ int commit_tree_extended(const char *msg, size_t msg_len,
15641564
if (encoding_is_utf8 && !verify_utf8(&buffer))
15651565
fprintf(stderr, _(commit_utf8_warn));
15661566

1567-
if (sign_commit && do_sign_commit(&buffer, sign_commit))
1568-
return -1;
1567+
if (sign_commit && do_sign_commit(&buffer, sign_commit)) {
1568+
result = -1;
1569+
goto out;
1570+
}
15691571

15701572
result = write_sha1_file(buffer.buf, buffer.len, commit_type, ret);
1573+
out:
15711574
strbuf_release(&buffer);
15721575
return result;
15731576
}

0 commit comments

Comments
 (0)