struct btrfs_ioctl_space_args *sargs = 0, *sargs_orig = 0;
int e, ret, count;
- sargs_orig = sargs = malloc(sizeof(struct btrfs_ioctl_space_args));
+ sargs_orig = sargs = calloc(1, sizeof(struct btrfs_ioctl_space_args));
if (!sargs) {
fprintf(stderr, "ERROR: not enough memory\n");
return NULL;
return -1;
}
- info = malloc(sizeof(struct device_info) * fi_args.num_devices);
+ info = calloc(fi_args.num_devices, sizeof(struct device_info));
if (!info) {
fprintf(stderr, "ERROR: not enough memory\n");
return -1;
}
for (i = 0, ndevs = 0 ; i <= fi_args.max_id ; i++) {
-
BUG_ON(ndevs >= fi_args.num_devices);
+ memset(&dev_info, 0, sizeof(dev_info));
ret = get_device_info(fd, i, &dev_info);
if (ret == -ENODEV)