summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 97a5e34)
raw | patch | inline | side by side (parent: 97a5e34)
author | Jonathan Nieder <jrnieder@gmail.com> | |
Sun, 5 Dec 2010 09:32:53 +0000 (03:32 -0600) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 8 Dec 2010 00:04:02 +0000 (16:04 -0800) |
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>
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>
vcs-svn/repo_tree.c | patch | blob | history |
diff --git a/vcs-svn/repo_tree.c b/vcs-svn/repo_tree.c
index e94d91d12966562e4cd43df9c34990dddc3465c3..e3d1fa35444dd693ab8723a030b9fc6265cad8bc 100644 (file)
--- a/vcs-svn/repo_tree.c
+++ b/vcs-svn/repo_tree.c
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) {
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);