avoid double-free on corrupt bloom filter (bloom.c) use partition size instead of dirstat to allow : syntax (wrarena.c) Reference: /n/sources/patch/applied/venti Date: Mon Oct 29 19:15:48 CET 2007 Signed-off-by: rsc@swtch.com --- /sys/src/cmd/venti/srv/bloom.c Mon Oct 29 19:15:16 2007 +++ /sys/src/cmd/venti/srv/bloom.c Mon Oct 29 19:15:16 2007 @@ -53,7 +53,6 @@ */ if(bloominit(b, 0, buf) < 0){ vtfree(b); - freepart(p); return nil; }else{ /* --- /sys/src/cmd/venti/srv/wrarena.c Mon Oct 29 19:15:17 2007 +++ /sys/src/cmd/venti/srv/wrarena.c Mon Oct 29 19:15:17 2007 @@ -133,7 +133,6 @@ Arena *arena; u64int offset, aoffset; Part *part; - Dir *d; uchar buf[8192]; ArenaHead head; ZClump zerocl; @@ -178,9 +177,6 @@ statsinit(); - if((d = dirstat(file)) == nil) - sysfatal("can't stat file %s: %r", file); - part = initpart(file, OREAD); if(part == nil) sysfatal("can't open file %s: %r", file); @@ -190,9 +186,9 @@ if(unpackarenahead(&head, buf) < 0) sysfatal("corrupted arena header: %r"); - if(aoffset+head.size > d->length) + if(aoffset+head.size > part->size) sysfatal("arena is truncated: want %llud bytes have %llud\n", - head.size, d->length); + head.size, part->size); partblocksize(part, head.blocksize); initdcache(8 * MaxDiskBlock);