summaryrefslogtreecommitdiff
path: root/misc-utils
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-11-10 14:51:52 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-11-10 15:30:04 +0100
commitf4ce3f052539ef536a1dfa7ed433f1814471a754 (patch)
tree251f947625dda44f3e7621139b1e1f15717c4214 /misc-utils
parentfcf6efdf03a827544739e6d1cc66dfb42f27a8b1 (diff)
ftl_check: don't leak temporary buffers
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'misc-utils')
-rw-r--r--misc-utils/ftl_check.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/misc-utils/ftl_check.c b/misc-utils/ftl_check.c
index e854922..5a04155 100644
--- a/misc-utils/ftl_check.c
+++ b/misc-utils/ftl_check.c
@@ -75,7 +75,7 @@ static void check_partition(int fd)
erase_unit_header_t hdr, hdr2;
off_t i;
u_int j, nbam, *bam;
- int control, data, free, deleted;
+ int control, data, blk_free, deleted;
/* Get partition size, block size */
if (ioctl(fd, MEMGETINFO, &mtd) != 0) {
@@ -150,10 +150,10 @@ static void check_partition(int fd)
perror("read failed");
break;
}
- free = deleted = control = data = 0;
+ blk_free = deleted = control = data = 0;
for (j = 0; j < nbam; j++) {
if (BLOCK_FREE(le32_to_cpu(bam[j])))
- free++;
+ blk_free++;
else if (BLOCK_DELETED(le32_to_cpu(bam[j])))
deleted++;
else switch (BLOCK_TYPE(le32_to_cpu(bam[j]))) {
@@ -163,9 +163,11 @@ static void check_partition(int fd)
}
}
printf(" Block allocation: %d control, %d data, %d free,"
- " %d deleted\n", control, data, free, deleted);
+ " %d deleted\n", control, data, blk_free, deleted);
}
}
+
+ free(bam);
} /* format_partition */
/* Show usage information */