diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2010-12-05 03:32:53 -0600 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-12-07 16:04:02 -0800 |
commit | 3c93983875af53b9f172d7f7a1022d0954cb5689 (patch) | |
tree | f7676ecf1f9ae1d680c2c79c16202065eed7e229 /vcs-svn/repo_tree.c | |
parent | 97a5e3453abf63bbf5926979fcd89efb4388e937 (diff) | |
download | git-3c93983875af53b9f172d7f7a1022d0954cb5689.tar.gz git-3c93983875af53b9f172d7f7a1022d0954cb5689.tar.xz |
vcs-svn: fix intermittent repo_tree corruption
Pointers to directory entries do not remain valid after a call to
dent_insert.
Noticed in the course of importing a small Subversion repository
(~1000 revs); after setting up a dirent for a certain path as a
placeholder, by luck dent_insert would trigger a realloc that
shifted around addresses, resulting in an import with that file
replaced by a directory.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'vcs-svn/repo_tree.c')
-rw-r--r-- | vcs-svn/repo_tree.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/vcs-svn/repo_tree.c b/vcs-svn/repo_tree.c index e94d91d12..e3d1fa354 100644 --- a/vcs-svn/repo_tree.c +++ b/vcs-svn/repo_tree.c @@ -131,7 +131,7 @@ static void repo_write_dirent(uint32_t *path, uint32_t mode, if (dent == key) { dent->mode = REPO_MODE_DIR; dent->content_offset = 0; - dent_insert(&dir->entries, dent); + dent = dent_insert(&dir->entries, dent); } if (dent_offset(dent) < dent_pool.committed) { @@ -142,7 +142,7 @@ static void repo_write_dirent(uint32_t *path, uint32_t mode, dent->name_offset = name; dent->mode = REPO_MODE_DIR; dent->content_offset = dir_o; - dent_insert(&dir->entries, dent); + dent = dent_insert(&dir->entries, dent); } dir = repo_dir_from_dirent(dent); |