diff --git a/stand/common/disk.c b/stand/common/disk.c --- a/stand/common/disk.c +++ b/stand/common/disk.c @@ -468,7 +468,7 @@ if (*cp != '\0' && *cp != ':') return (EINVAL); - dev = malloc(sizeof(*dev)); + dev = calloc(sizeof(*dev), 1); if (dev == NULL) return (ENOMEM); dev->dd.d_unit = unit; diff --git a/stand/kboot/kboot/hostdisk.c b/stand/kboot/kboot/hostdisk.c --- a/stand/kboot/kboot/hostdisk.c +++ b/stand/kboot/kboot/hostdisk.c @@ -465,7 +465,7 @@ return (EINVAL); } free(fn); - dev = malloc(sizeof(*dev)); + dev = calloc(sizeof(*dev), 1); if (dev == NULL) return (ENOMEM); dev->d_unit = 0; diff --git a/stand/libofw/devicename.c b/stand/libofw/devicename.c --- a/stand/libofw/devicename.c +++ b/stand/libofw/devicename.c @@ -98,7 +98,7 @@ if (ofw_path_to_handle(devspec, ofwtype, &rem_path) == -1) return (ENOENT); - idev = malloc(sizeof(struct ofw_devdesc)); + idev = calloc(sizeof(struct ofw_devdesc), 1); if (idev == NULL) { printf("ofw_parsedev: malloc failed\n"); return (ENOMEM); diff --git a/stand/libsa/dev.c b/stand/libsa/dev.c --- a/stand/libsa/dev.c +++ b/stand/libsa/dev.c @@ -72,7 +72,7 @@ int unit, err; char *cp; - idev = malloc(sizeof(struct devdesc)); + idev = calloc(sizeof(struct devdesc), 1); if (idev == NULL) return (ENOMEM); diff --git a/stand/libsa/zfs/zfs.c b/stand/libsa/zfs/zfs.c --- a/stand/libsa/zfs/zfs.c +++ b/stand/libsa/zfs/zfs.c @@ -1643,7 +1643,7 @@ spa = spa_find_by_name(poolname); if (!spa) return (ENXIO); - dev = malloc(sizeof(*dev)); + dev = calloc(sizeof(*dev), 1); if (dev == NULL) return (ENOMEM); dev->pool_guid = spa->spa_guid; diff --git a/stand/uboot/devicename.c b/stand/uboot/devicename.c --- a/stand/uboot/devicename.c +++ b/stand/uboot/devicename.c @@ -102,7 +102,7 @@ } if (dv == NULL) return(ENOENT); - idev = malloc(sizeof(struct uboot_devdesc)); + idev = calloc(sizeof(struct uboot_devdesc), 1); err = 0; np = (devspec + strlen(dv->dv_name));