From 5ad0e8c0aeab06cc8ce3a15ee37adfe7cc17c615 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Fri, 28 Aug 2015 00:03:55 +0000 Subject: fairly simple sizes for free(); ok tedu --- sys/kern/kern_bufq.c | 10 +++++++--- sys/kern/kern_exit.c | 4 ++-- sys/kern/subr_extent.c | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) (limited to 'sys/kern') diff --git a/sys/kern/kern_bufq.c b/sys/kern/kern_bufq.c index d819783f268..7ed83470e58 100644 --- a/sys/kern/kern_bufq.c +++ b/sys/kern/kern_bufq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_bufq.c,v 1.30 2015/03/14 03:38:50 jsg Exp $ */ +/* $OpenBSD: kern_bufq.c,v 1.31 2015/08/28 00:03:53 deraadt Exp $ */ /* * Copyright (c) 2010 Thordur I. Bjornsson * Copyright (c) 2010 David Gwynne @@ -328,7 +328,9 @@ bufq_fifo_create(void) void bufq_fifo_destroy(void *data) { - free(data, M_DEVBUF, 0); + struct bufq_fifo_head *head = data; + + free(head, M_DEVBUF, sizeof(*head)); } void @@ -445,7 +447,9 @@ bufq_nscan_create(void) void bufq_nscan_destroy(void *vdata) { - free(vdata, M_DEVBUF, 0); + struct bufq_nscan_data *data = vdata; + + free(data, M_DEVBUF, sizeof(*data)); } void diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index 7ee0872bd72..c0306617ca2 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.150 2015/08/22 20:18:49 deraadt Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.151 2015/08/28 00:03:53 deraadt Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -669,7 +669,7 @@ process_zap(struct process *pr) KASSERT(pr->ps_refcnt == 1); if (pr->ps_ptstat != NULL) - free(pr->ps_ptstat, M_SUBPROC, 0); + free(pr->ps_ptstat, M_SUBPROC, sizeof(*pr->ps_ptstat)); pool_put(&rusage_pool, pr->ps_ru); KASSERT(TAILQ_EMPTY(&pr->ps_threads)); limfree(pr->ps_limit); diff --git a/sys/kern/subr_extent.c b/sys/kern/subr_extent.c index dd6645068e2..d123c3f0f49 100644 --- a/sys/kern/subr_extent.c +++ b/sys/kern/subr_extent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_extent.c,v 1.56 2015/03/14 03:38:50 jsg Exp $ */ +/* $OpenBSD: subr_extent.c,v 1.57 2015/08/28 00:03:53 deraadt Exp $ */ /* $NetBSD: subr_extent.c,v 1.7 1996/11/21 18:46:34 cgd Exp $ */ /*- @@ -284,7 +284,7 @@ extent_destroy(struct extent *ex) /* If we're not a fixed extent, free the extent descriptor itself. */ if ((ex->ex_flags & EXF_FIXED) == 0) - free(ex, ex->ex_mtype, 0); + free(ex, ex->ex_mtype, sizeof(*ex)); } /* -- cgit v1.2.3