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>

Junio C Hamano committed May 8, 2017 at 13:21 UTC 443a12f37be1c5967785b83bf04935fe357afb9b
1 file changed +1
builtin/checkout.c
+1
@@ -247,6 +247,7 @@ static int checkout_merged(int pos, const struct checkout *state)
247 if (write_sha1_file(result_buf.ptr, result_buf.size,
248 blob_type, oid.hash))
249 die(_("Unable to add merge result for '%s'"), path);
250 + free(result_buf.ptr);
251 ce = make_cache_entry(mode, oid.hash, path, 2, 0);
252 if (!ce)
253 die(_("make_cache_entry failed for path '%s'"), path);