]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/pack-objects.c
tree-walk.c: do not leak internal structure in tree_entry_len()
[thirdparty/git.git] / builtin / pack-objects.c
index 2b18de5dc37bf849dbdbc892e4e9f3a34893dd9d..b4f78555507b984609ce5ef71c4a3b63dd73e4e5 100644 (file)
@@ -804,6 +804,10 @@ static int add_object_entry(const unsigned char *sha1, enum object_type type,
                off_t offset = find_pack_entry_one(sha1, p);
                if (offset) {
                        if (!found_pack) {
+                               if (!is_pack_valid(p)) {
+                                       warning("packfile %s cannot be accessed", p->pack_name);
+                                       continue;
+                               }
                                found_offset = offset;
                                found_pack = p;
                        }
@@ -975,7 +979,7 @@ static void add_pbase_object(struct tree_desc *tree,
        while (tree_entry(tree,&entry)) {
                if (S_ISGITLINK(entry.mode))
                        continue;
-               cmp = tree_entry_len(entry.path, entry.sha1) != cmplen ? 1 :
+               cmp = tree_entry_len(&entry) != cmplen ? 1 :
                      memcmp(name, entry.path, cmplen);
                if (cmp > 0)
                        continue;