Skip to content

Commit 443a12f

Browse files
committed
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d32de66 commit 443a12f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

builtin/checkout.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ static int checkout_merged(int pos, const struct checkout *state)
247247
if (write_sha1_file(result_buf.ptr, result_buf.size,
248248
blob_type, oid.hash))
249249
die(_("Unable to add merge result for '%s'"), path);
250+
free(result_buf.ptr);
250251
ce = make_cache_entry(mode, oid.hash, path, 2, 0);
251252
if (!ce)
252253
die(_("make_cache_entry failed for path '%s'"), path);

0 commit comments

Comments
 (0)