summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2016-08-01 11:44:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-08-01 18:45:30 (GMT)
commit548009c0d58c74dde2c51f675b369b4c50878f1b (patch)
tree8f67f25695a6b87eea5067fce0ba179e1aea4fd9 /sequencer.c
parentf1e2426b28399b563527d110c849acd65b680de6 (diff)
downloadgit-548009c0d58c74dde2c51f675b369b4c50878f1b.zip
git-548009c0d58c74dde2c51f675b369b4c50878f1b.tar.gz
git-548009c0d58c74dde2c51f675b369b4c50878f1b.tar.bz2
merge_trees(): ensure that the callers release output buffer
The recursive merge machinery accumulates its output in an output buffer, to be flushed at the end of merge_recursive(). At this point, we forgot to release the output buffer. When calling merge_trees() (i.e. the non-recursive part of the recursive merge) directly, the output buffer is never flushed because the caller may be merge_recursive() which wants to flush the output itself. For the same reason, merge_trees() cannot release the output buffer: it may still be needed. Forgetting to release the output buffer did not matter much when running git-checkout, or git-merge-recursive, because we exited after the operation anyway. Ever since cherry-pick learned to pick a commit range, however, this memory leak had the potential of becoming a problem. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sequencer.c b/sequencer.c
index 286a435..ec50519 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -293,6 +293,7 @@ static int do_recursive_merge(struct commit *base, struct commit *next,
clean = merge_trees(&o,
head_tree,
next_tree, base_tree, &result);
+ strbuf_release(&o.obuf);
if (clean < 0)
return clean;