Re: [PATCH/WIP 3/7] fast-import: fix a data corruption in parse_ls
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Jul 28, 2011, 07:34 UTC
- Message-ID
- <20110728073434.GC4179@elie>
- In-Reply-To
- <1311828370-30477-4-git-send-email-divanorama@gmail.com>
Dmitry Ivankov wrote:
> store_tree sets versions[0] = versions[1] unconditionally. This is fine > if it is run from the very root.
True.
> But if it's run for a intermediate > node in parse_ls, node's parent versions[0] can become invalid as it > references it's children versions[0].
A puzzle: when would parse_ls() call store_tree() on a subdirectory? The store_tree() call is preceded by
tree_content_get(root, p, &leaf);
which makes a deep copy of "root" in leaf (which seems to be leaked --- oops).