-/* $OpenBSD: ffs_vfsops.c,v 1.141 2014/07/12 18:44:01 tedu Exp $ */
+/* $OpenBSD: ffs_vfsops.c,v 1.142 2014/07/13 23:33:26 tedu Exp $ */
/* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */
/*
if ((error = ffs_mountfs(rootvp, mp, p)) != 0) {
mp->mnt_vfc->vfc_refcount--;
vfs_unbusy(mp);
- free(mp, M_MOUNT, 0);
+ free(mp, M_MOUNT, sizeof(*mp));
vrele(swapdev_vp);
vrele(rootvp);
return (error);
VOP_UNLOCK(devvp, 0, p);
if (ump) {
- free(ump->um_fs, M_UFSMNT, 0);
- free(ump, M_UFSMNT, 0);
- mp->mnt_data = (qaddr_t)0;
+ free(ump->um_fs, M_UFSMNT, sizeof(*ump->um_fs));
+ free(ump, M_UFSMNT, sizeof(*ump));
+ mp->mnt_data = NULL;
}
return (error);
}
NOCRED, p);
vput(ump->um_devvp);
free(fs->fs_csp, M_UFSMNT, 0);
- free(fs, M_UFSMNT, 0);
- free(ump, M_UFSMNT, 0);
+ free(fs, M_UFSMNT, sizeof(*fs));
+ free(ump, M_UFSMNT, sizeof(*ump));
mp->mnt_data = (qaddr_t)0;
mp->mnt_flag &= ~MNT_LOCAL;
return (error);
-/* $OpenBSD: ufs_dirhash.c,v 1.27 2014/07/13 23:18:01 tedu Exp $ */
+/* $OpenBSD: ufs_dirhash.c,v 1.28 2014/07/13 23:33:26 tedu Exp $ */
/*
* Copyright (c) 2001, 2002 Ian Dowse. All rights reserved.
*
for (i = 0; i < narrays; i++)
if (dh->dh_hash[i] != NULL)
DIRHASH_BLKFREE(dh->dh_hash[i]);
- free(dh->dh_hash, M_DIRHASH, 0);
+ free(dh->dh_hash, M_DIRHASH, narrays * sizeof(dh->dh_hash[0]));
}
if (dh->dh_blkfree != NULL)
- free(dh->dh_blkfree, M_DIRHASH, 0);
- free(dh, M_DIRHASH, 0);
+ free(dh->dh_blkfree, M_DIRHASH,
+ nblocks * sizeof(dh->dh_blkfree[0]));
+ free(dh, M_DIRHASH, sizeof(*dh));
ip->i_dirhash = NULL;
DIRHASHLIST_LOCK();
ufs_dirhashmem -= memreqd;
if (dh->dh_hash != NULL) {
for (i = 0; i < dh->dh_narrays; i++)
DIRHASH_BLKFREE(dh->dh_hash[i]);
- free(dh->dh_hash, M_DIRHASH, 0);
- free(dh->dh_blkfree, M_DIRHASH, 0);
+ free(dh->dh_hash, M_DIRHASH, dh->dh_narrays * sizeof(*dh->dh_hash));
+ free(dh->dh_blkfree, M_DIRHASH, dh->dh_nblk * sizeof(*dh->dh_blkfree));
mem += dh->dh_narrays * sizeof(*dh->dh_hash) +
dh->dh_narrays * DH_NBLKOFF * sizeof(**dh->dh_hash) +
dh->dh_nblk * sizeof(*dh->dh_blkfree);
}
- free(dh, M_DIRHASH, 0);
+ free(dh, M_DIRHASH, sizeof(*dh));
ip->i_dirhash = NULL;
DIRHASHLIST_LOCK();
DIRHASHLIST_UNLOCK();
for (i = 0; i < narrays; i++)
DIRHASH_BLKFREE(hash[i]);
- free(hash, M_DIRHASH, 0);
- free(blkfree, M_DIRHASH, 0);
+ free(hash, M_DIRHASH, narrays * sizeof(*dh->dh_hash));
+ free(blkfree, M_DIRHASH, dh->dh_nblk * sizeof(*dh->dh_blkfree));
/* Account for the returned memory, and repeat if necessary. */
DIRHASHLIST_LOCK();