X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=fast-import.c;h=a85275dc682d2bb8068f003b8281c3933488f010;hb=f47ff5afe4208488c6f977b497b81acdce941afc;hp=4b9c4b73a020e9eefa4caf0bd6ec833df424c9a0;hpb=c0129439d034a59ca761bcd6e0d50becbee80cee;p=git.git diff --git a/fast-import.c b/fast-import.c index 4b9c4b73a..a85275dc6 100644 --- a/fast-import.c +++ b/fast-import.c @@ -855,15 +855,15 @@ static struct tree_content *dup_tree_content(struct tree_content *s) static void start_packfile(void) { - static char tmpfile[PATH_MAX]; + static char tmp_file[PATH_MAX]; struct packed_git *p; struct pack_header hdr; int pack_fd; - pack_fd = odb_mkstemp(tmpfile, sizeof(tmpfile), + pack_fd = odb_mkstemp(tmp_file, sizeof(tmp_file), "pack/tmp_pack_XXXXXX"); - p = xcalloc(1, sizeof(*p) + strlen(tmpfile) + 2); - strcpy(p->pack_name, tmpfile); + p = xcalloc(1, sizeof(*p) + strlen(tmp_file) + 2); + strcpy(p->pack_name, tmp_file); p->pack_fd = pack_fd; p->do_not_close = 1; pack_file = sha1fd(pack_fd, p->pack_name); @@ -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); @@ -2712,7 +2714,7 @@ static void parse_new_tag(void) /* Obtain the new tag name from the rest of our command */ sp = strchr(command_buf.buf, ' ') + 1; t = pool_alloc(sizeof(struct tag)); - t->next_tag = NULL; + memset(t, 0, sizeof(struct tag)); t->name = pool_strdup(sp); if (last_tag) last_tag->next_tag = t; @@ -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); }