{
struct dir_list *dp;
- dp = malloc(sizeof(struct dir_list));
- if (!dp)
- return;
- dp->name = malloc(strlen(name)+1);
- if (!dp->name) {
- free(dp);
- return;
- }
+ dp = xmalloc(sizeof(struct dir_list));
+ dp->name = xmalloc(strlen(name)+1);
strcpy(dp->name, name);
dp->next = *list;
*list = dp;
if (S_ISDIR(st.st_mode))
add_to_dirlist(path, list);
if (S_ISBLK(st.st_mode) && st.st_rdev == device) {
- cp = malloc(strlen(path)+1);
- if (!cp) {
- closedir(dir);
- return ENOMEM;
- }
+ cp = xmalloc(strlen(path)+1);
strcpy(cp, path);
*ret_path = cp;
goto success;
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;
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;
ssize_t actual;
errcode_t retval;
- buf = malloc(fs->blocksize);
- if (!buf)
- return ENOMEM;
+ buf = xmalloc(fs->blocksize);
/*
* Write out the superblock
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.
}
size = size * fs->group_desc_count;
- buf = malloc(size);
- if (!buf)
- return ENOMEM;
+ buf = xmalloc(size);
actual = read(fd, buf, size);
if (actual == -1) {
length = EXT2_INODE_SIZE(fs->super);
if (length > (int) sizeof(struct ext2_inode_large)) {
- w_inode = malloc(length);
- if (!w_inode)
- return ENOMEM;
+ w_inode = xmalloc(length);
} else
w_inode = &temp_inode;
memset(w_inode, 0, length);
return ext2fs_write_inode_full(fs, ino, inode,
sizeof(struct ext2_inode));
- buf = malloc(size);
- if (!buf)
- return ENOMEM;
+ buf = xmalloc(size);
memset(buf, 0, size);
*buf = *inode;