summaryrefslogtreecommitdiffstats
path: root/bitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'bitmap.c')
-rw-r--r--bitmap.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/bitmap.c b/bitmap.c
index fdf8884..8617669 100644
--- a/bitmap.c
+++ b/bitmap.c
@@ -122,11 +122,10 @@ bitmap_info_t *bitmap_fd_read(int fd, int brief)
*/
unsigned long long total_bits = 0, read_bits = 0, dirty_bits = 0;
bitmap_info_t *info;
- char *buf, *unaligned;
+ void *buf;
int n, skip;
- unaligned = malloc(8192*2);
- buf = (char*) ((unsigned long)unaligned | 8191)+1;
+ posix_memalign(&buf, 512, 8192);
n = read(fd, buf, 8192);
info = malloc(sizeof(*info));
@@ -145,7 +144,6 @@ bitmap_info_t *bitmap_fd_read(int fd, int brief)
fprintf(stderr, Name ": failed to read superblock of bitmap "
"file: %s\n", strerror(errno));
free(info);
- free(unaligned);
return NULL;
}
memcpy(&info->sb, buf, sizeof(info->sb));