From d5826903c171981d967dc6a8c430dfaaed05c53a Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 12 Jun 2005 00:45:09 +0000 Subject: use xmalloc instead of malloc --- e2fsprogs/ext2fs/imager.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'e2fsprogs/ext2fs/imager.c') diff --git a/e2fsprogs/ext2fs/imager.c b/e2fsprogs/ext2fs/imager.c index 596fbbebe..3f2826b82 100644 --- a/e2fsprogs/ext2fs/imager.c +++ b/e2fsprogs/ext2fs/imager.c @@ -66,9 +66,7 @@ errcode_t ext2fs_image_inode_write(ext2_filsys fs, int fd, int flags) ssize_t actual; errcode_t retval; - buf = malloc(fs->blocksize * BUF_BLOCKS); - if (!buf) - return ENOMEM; + buf = xmalloc(fs->blocksize * BUF_BLOCKS); for (group = 0; group < fs->group_desc_count; group++) { blk = fs->group_desc[(unsigned)group].bg_inode_table; @@ -138,9 +136,7 @@ errcode_t ext2fs_image_inode_read(ext2_filsys fs, int fd, ssize_t actual; errcode_t retval; - buf = malloc(fs->blocksize * BUF_BLOCKS); - if (!buf) - return ENOMEM; + buf = xmalloc(fs->blocksize * BUF_BLOCKS); for (group = 0; group < fs->group_desc_count; group++) { blk = fs->group_desc[(unsigned)group].bg_inode_table; @@ -187,9 +183,7 @@ errcode_t ext2fs_image_super_write(ext2_filsys fs, int fd, ssize_t actual; errcode_t retval; - buf = malloc(fs->blocksize); - if (!buf) - return ENOMEM; + buf = xmalloc(fs->blocksize); /* * Write out the superblock @@ -238,9 +232,7 @@ errcode_t ext2fs_image_super_read(ext2_filsys fs, int fd, errcode_t retval; size = fs->blocksize * (fs->group_desc_count + 1); - buf = malloc(size); - if (!buf) - return ENOMEM; + buf = xmalloc(size); /* * Read it all in. @@ -364,9 +356,7 @@ errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags) } size = size * fs->group_desc_count; - buf = malloc(size); - if (!buf) - return ENOMEM; + buf = xmalloc(size); actual = read(fd, buf, size); if (actual == -1) { -- cgit v1.2.3