unpack-trees: handle lstat failure for existing directory
[gitweb.git] / pack-revindex.c
index 6096b6224ad551086afa346617eb714c15a51f78..77a0465be6f6a79814aa3c009612736770b342a1 100644 (file)
@@ -140,7 +140,8 @@ struct revindex_entry *find_pack_revindex(struct packed_git *p, off_t ofs)
                else
                        lo = mi + 1;
        } while (lo < hi);
-       die("internal error: pack revindex corrupt");
+       error("bad offset for revindex");
+       return NULL;
 }
 
 void discard_revindex(void)
@@ -148,8 +149,7 @@ void discard_revindex(void)
        if (pack_revindex_hashsz) {
                int i;
                for (i = 0; i < pack_revindex_hashsz; i++)
-                       if (pack_revindex[i].revindex)
-                               free(pack_revindex[i].revindex);
+                       free(pack_revindex[i].revindex);
                free(pack_revindex);
                pack_revindex_hashsz = 0;
        }