summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2012-03-26 12:10:25 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2012-03-26 12:10:25 -0700
commit79efeae69d843af575fb27696f5263fe76c570a6 (patch)
tree91323d37d30cdf47dec3a2a9ef88933ac7f495e6 /fast-import.c
parentMerge branch 'ph/rerere-doc' into maint (diff)
parentfast-import: don't allow 'ls' of path with empty components (diff)
downloadtgif-79efeae69d843af575fb27696f5263fe76c570a6.tar.xz
Merge branch 'jn/maint-fast-import-empty-ls' into maint
* jn/maint-fast-import-empty-ls: fast-import: don't allow 'ls' of path with empty components fast-import: leakfix for 'ls' of dirty trees
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fast-import.c b/fast-import.c
index c1486cabba..a85275dc68 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1641,6 +1641,8 @@ static int tree_content_get(
n = slash1 - p;
else
n = strlen(p);
+ if (!n)
+ die("Empty path component found in input");
if (!root->tree)
load_tree(root);
@@ -3028,6 +3030,8 @@ static void parse_ls(struct branch *b)
store_tree(&leaf);
print_ls(leaf.versions[1].mode, leaf.versions[1].sha1, p);
+ if (leaf.tree)
+ release_tree_content_recursive(leaf.tree);
if (!b || root != &b->branch_tree)
release_tree_entry(root);
}