summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-05-08 04:21:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-05-10 04:12:15 (GMT)
commit443a12f37be1c5967785b83bf04935fe357afb9b (patch)
tree2bf57febbd38bb9443113c89ec308306b5eaadb2 /builtin
parentd32de66a07c600c14f70e6d435f8f9c496b0d625 (diff)
downloadgit-443a12f37be1c5967785b83bf04935fe357afb9b.zip
git-443a12f37be1c5967785b83bf04935fe357afb9b.tar.gz
git-443a12f37be1c5967785b83bf04935fe357afb9b.tar.bz2
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>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/checkout.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 5faea3a..94849cf 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -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);