diff options
author | David Hill <dhill@cvs.openbsd.org> | 2018-03-30 17:35:21 +0000 |
---|---|---|
committer | David Hill <dhill@cvs.openbsd.org> | 2018-03-30 17:35:21 +0000 |
commit | e44044d8e139f2e4a00d41e0b0c18f6b3fe99338 (patch) | |
tree | 63eb63ac3b65462681f5cf5ec501196a83adbc5d | |
parent | 2a4cb6e1d665094ece70106dab00b25279165315 (diff) |
Add sizes to some free() calls.
OK visa@
-rw-r--r-- | sys/ufs/ffs/ffs_inode.c | 4 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_softdep.c | 10 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 8 |
3 files changed, 12 insertions, 10 deletions
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c index fd956ebefb4..62ebc844cd7 100644 --- a/sys/ufs/ffs/ffs_inode.c +++ b/sys/ufs/ffs/ffs_inode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_inode.c,v 1.76 2016/02/27 18:50:38 natano Exp $ */ +/* $OpenBSD: ffs_inode.c,v 1.77 2018/03/30 17:35:20 dhill Exp $ */ /* $NetBSD: ffs_inode.c,v 1.10 1996/05/11 18:27:19 mycroft Exp $ */ /* @@ -560,7 +560,7 @@ ffs_indirtrunc(struct inode *ip, daddr_t lbn, daddr_t dbn, } } if (copy != NULL) { - free(copy, M_TEMP, 0); + free(copy, M_TEMP, fs->fs_bsize); } else { bp->b_flags |= B_INVAL; brelse(bp); diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c index 97b3d244025..164764323a0 100644 --- a/sys/ufs/ffs/ffs_softdep.c +++ b/sys/ufs/ffs/ffs_softdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_softdep.c,v 1.138 2018/02/10 05:24:23 deraadt Exp $ */ +/* $OpenBSD: ffs_softdep.c,v 1.139 2018/03/30 17:35:20 dhill Exp $ */ /* * Copyright 1998, 2000 Marshall Kirk McKusick. All Rights Reserved. @@ -2307,7 +2307,8 @@ check_inode_unwritten(struct inodedep *inodedep) if (inodedep->id_state & ONWORKLIST) WORKLIST_REMOVE(&inodedep->id_list); if (inodedep->id_savedino1 != NULL) { - free(inodedep->id_savedino1, M_INODEDEP, 0); + free(inodedep->id_savedino1, M_INODEDEP, + sizeof(struct ufs1_dinode)); inodedep->id_savedino1 = NULL; } if (free_inodedep(inodedep) == 0) { @@ -3845,7 +3846,7 @@ softdep_disk_write_complete(struct buf *bp) if (indirdep->ir_state & GOINGAWAY) panic("disk_write_complete: indirdep gone"); memcpy(bp->b_data, indirdep->ir_saveddata, bp->b_bcount); - free(indirdep->ir_saveddata, M_INDIRDEP, 0); + free(indirdep->ir_saveddata, M_INDIRDEP, bp->b_bcount); indirdep->ir_saveddata = NULL; indirdep->ir_state &= ~UNDONE; indirdep->ir_state |= ATTACHED; @@ -4034,7 +4035,8 @@ handle_written_inodeblock(struct inodedep *inodedep, struct buf *bp) *dp1 = *inodedep->id_savedino1; else *dp2 = *inodedep->id_savedino2; - free(inodedep->id_savedino1, M_INODEDEP, 0); + free(inodedep->id_savedino1, M_INODEDEP, + sizeof(struct ufs1_dinode)); inodedep->id_savedino1 = NULL; if ((bp->b_flags & B_DELWRI) == 0) stat_inode_bitmap++; diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 96a6f284910..50fc5ef6e59 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_vfsops.c,v 1.173 2018/03/15 04:22:16 deraadt Exp $ */ +/* $OpenBSD: ffs_vfsops.c,v 1.174 2018/03/30 17:35:20 dhill Exp $ */ /* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */ /* @@ -447,7 +447,7 @@ success: fs->fs_clean = ronly && (fs->fs_flags & FS_UNCLEAN) == 0 ? 1 : 0; if (ronly) - free(fs->fs_contigdirs, M_UFSMNT, 0); + free(fs->fs_contigdirs, M_UFSMNT, fs->fs_ncg); } if (!ronly) { if (mp->mnt_flag & MNT_SOFTDEP) @@ -911,7 +911,7 @@ ffs_mountfs(struct vnode *devvp, struct mount *mp, struct proc *p) if ((fs->fs_flags & FS_DOSOFTDEP) && (error = softdep_mount(devvp, mp, fs, cred)) != 0) { free(fs->fs_csp, M_UFSMNT, 0); - free(fs->fs_contigdirs, M_UFSMNT, 0); + free(fs->fs_contigdirs, M_UFSMNT, fs->fs_ncg); goto out; } fs->fs_fmod = 1; @@ -1046,7 +1046,7 @@ ffs_unmount(struct mount *mp, int mntflags, struct proc *p) fs->fs_clean = 0; return (error); } - free(fs->fs_contigdirs, M_UFSMNT, 0); + free(fs->fs_contigdirs, M_UFSMNT, fs->fs_ncg); } ump->um_devvp->v_specmountpoint = NULL; |