Subject: Re: [PATCH/WIP 3/7] fast-import: fix a data corruption in parse_ls

From: Jonathan Nieder <[email-masked]>
Date: Thu, 28 Jul 2011 09:34:34 +0200

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).