summaryrefslogtreecommitdiff
path: root/e2fsprogs
diff options
context:
space:
mode:
authorDenys Vlasenko2010-01-08 09:07:50 +0100
committerDenys Vlasenko2010-01-08 09:07:50 +0100
commit9037787eaee5efb58fd46f326397193b16b161dd (patch)
treedfd0e7d93faf711ca7dcf8c7fe0abfb21082e3d3 /e2fsprogs
parentef3817c6dcbf9270d36b48a0547e507221abce74 (diff)
downloadbusybox-9037787eaee5efb58fd46f326397193b16b161dd.zip
busybox-9037787eaee5efb58fd46f326397193b16b161dd.tar.gz
*: fix places where we were still using malloc/realloc
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'e2fsprogs')
-rw-r--r--e2fsprogs/old_e2fsprogs/ext2fs/ext2fs_inline.c4
-rw-r--r--e2fsprogs/old_e2fsprogs/fsck.c8
2 files changed, 3 insertions, 9 deletions
diff --git a/e2fsprogs/old_e2fsprogs/ext2fs/ext2fs_inline.c b/e2fsprogs/old_e2fsprogs/ext2fs/ext2fs_inline.c
index da1cf5b..b9aab44 100644
--- a/e2fsprogs/old_e2fsprogs/ext2fs/ext2fs_inline.c
+++ b/e2fsprogs/old_e2fsprogs/ext2fs/ext2fs_inline.c
@@ -50,9 +50,7 @@ errcode_t ext2fs_resize_mem(unsigned long EXT2FS_ATTR((unused)) old_size,
/* Use "memcpy" for pointer assignments here to avoid problems
* with C99 strict type aliasing rules. */
memcpy(&p, ptr, sizeof (p));
- p = realloc(p, size);
- if (!p)
- return EXT2_ET_NO_MEMORY;
+ p = xrealloc(p, size);
memcpy(ptr, &p, sizeof (p));
return 0;
}
diff --git a/e2fsprogs/old_e2fsprogs/fsck.c b/e2fsprogs/old_e2fsprogs/fsck.c
index 687938c..c0964f7 100644
--- a/e2fsprogs/old_e2fsprogs/fsck.c
+++ b/e2fsprogs/old_e2fsprogs/fsck.c
@@ -377,8 +377,7 @@ static struct fs_info *create_fs_device(const char *device, const char *mntpnt,
{
struct fs_info *fs;
- if (!(fs = malloc(sizeof(struct fs_info))))
- return NULL;
+ fs = xmalloc(sizeof(struct fs_info));
fs->device = string_copy(device);
fs->mountpt = string_copy(mntpnt);
@@ -573,10 +572,7 @@ static int execute(const char *type, const char *device, const char *mntpt,
struct fsck_instance *inst, *p;
pid_t pid;
- inst = malloc(sizeof(struct fsck_instance));
- if (!inst)
- return ENOMEM;
- memset(inst, 0, sizeof(struct fsck_instance));
+ inst = xzalloc(sizeof(struct fsck_instance));
prog = xasprintf("fsck.%s", type);
argv[0] = prog;