commit 32c20d64995844daaaed9c9a11afc03ae68c7753
parent 39f907c919176a8fed990e10e95a7f7371aedf40
Author: sin <sin@2f30.org>
Date: Sun, 17 Feb 2019 12:10:35 +0000
Allocate entry out of loop so we don't hit a bogus free
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dedup.c b/dedup.c
@@ -550,9 +550,9 @@ walk(int (*fn)(struct ent *, void *), void *arg)
struct ent *ent;
uint64_t i;
+ ent = alloc_ent();
lseek(ifd, sizeof(enthdr), SEEK_SET);
for (i = 0; i < enthdr.nents; i++) {
- ent = alloc_ent();
if (xread(ifd, ent, sizeof(*ent)) == 0)
errx(1, "read: unexpected EOF");