提交 443a12f3 编写于 作者: J Junio C Hamano

checkout: fix memory leak

When "git checkout -m" does an in-core three-way merge to carry
local modifications forward to check out a different branch, the
code forgot to free the updated contents it has in-core.
Noticed-by: NRené Scharfe <l.s.r@web.de>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 d32de66a
...@@ -247,6 +247,7 @@ static int checkout_merged(int pos, const struct checkout *state) ...@@ -247,6 +247,7 @@ static int checkout_merged(int pos, const struct checkout *state)
if (write_sha1_file(result_buf.ptr, result_buf.size, if (write_sha1_file(result_buf.ptr, result_buf.size,
blob_type, oid.hash)) blob_type, oid.hash))
die(_("Unable to add merge result for '%s'"), path); die(_("Unable to add merge result for '%s'"), path);
free(result_buf.ptr);
ce = make_cache_entry(mode, oid.hash, path, 2, 0); ce = make_cache_entry(mode, oid.hash, path, 2, 0);
if (!ce) if (!ce)
die(_("make_cache_entry failed for path '%s'"), path); die(_("make_cache_entry failed for path '%s'"), path);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册