1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-23 07:56:24 +02:00

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: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Junio C Hamano 2017-05-08 13:21:06 +09:00
parent d32de66a07
commit 443a12f37b

View File

@ -247,6 +247,7 @@ static int checkout_merged(int pos, const struct checkout *state)
if (write_sha1_file(result_buf.ptr, result_buf.size,
blob_type, oid.hash))
die(_("Unable to add merge result for '%s'"), path);
free(result_buf.ptr);
ce = make_cache_entry(mode, oid.hash, path, 2, 0);
if (!ce)
die(_("make_cache_entry failed for path '%s'"), path);