summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2014-11-01 23:58:29 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2014-11-01 23:58:29 +0000
commit4b234ebfbefb6436a0f610da07d2af6e614d440b (patch)
treed1d03d054acd099019e458950abf270f2f480023 /sys/kern
parentb8640d0d5fac5341aa92e1d9531e47bd55ef04ca (diff)
add a few sizes to free
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_sensors.c4
-rw-r--r--sys/kern/kern_subr.c6
-rw-r--r--sys/kern/kern_sysctl.c14
-rw-r--r--sys/kern/kern_task.c6
-rw-r--r--sys/kern/kern_tc.c4
-rw-r--r--sys/kern/kern_workq.c6
6 files changed, 20 insertions, 20 deletions
diff --git a/sys/kern/kern_sensors.c b/sys/kern/kern_sensors.c
index 4a564e12a57..22855ed4886 100644
--- a/sys/kern/kern_sensors.c
+++ b/sys/kern/kern_sensors.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sensors.c,v 1.29 2014/09/14 14:17:25 jsg Exp $ */
+/* $OpenBSD: kern_sensors.c,v 1.30 2014/11/01 23:58:28 tedu Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -247,7 +247,7 @@ sensor_task_work(void *xst, void *arg)
rw_exit_write(&st->lock);
if (period == 0)
- free(st, M_DEVBUF, 0);
+ free(st, M_DEVBUF, sizeof(struct sensor_task));
else
timeout_add_sec(&st->timeout, period);
}
diff --git a/sys/kern/kern_subr.c b/sys/kern/kern_subr.c
index 596032ad100..dff2a1b6454 100644
--- a/sys/kern/kern_subr.c
+++ b/sys/kern/kern_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_subr.c,v 1.40 2014/07/13 15:48:41 tedu Exp $ */
+/* $OpenBSD: kern_subr.c,v 1.41 2014/11/01 23:58:28 tedu Exp $ */
/* $NetBSD: kern_subr.c,v 1.15 1996/04/09 17:21:56 ragge Exp $ */
/*
@@ -221,7 +221,7 @@ hook_disestablish(struct hook_desc_head *head, void *vhook)
#endif
hdp = vhook;
TAILQ_REMOVE(head, hdp, hd_list);
- free(hdp, M_DEVBUF, 0);
+ free(hdp, M_DEVBUF, sizeof(*hdp));
}
/*
@@ -244,7 +244,7 @@ dohooks(struct hook_desc_head *head, int flags)
TAILQ_REMOVE(head, hdp, hd_list);
(*hdp->hd_fn)(hdp->hd_arg);
if ((flags & HOOK_FREE) != 0)
- free(hdp, M_DEVBUF, 0);
+ free(hdp, M_DEVBUF, sizeof(*hdp));
}
}
}
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index dcf6b861981..ed72b739188 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.267 2014/10/17 01:51:39 tedu Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.268 2014/11/01 23:58:28 tedu Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -1288,7 +1288,7 @@ sysctl_file(int *name, u_int namelen, char *where, size_t *sizep,
error = EINVAL;
break;
}
- free(kf, M_TEMP, 0);
+ free(kf, M_TEMP, sizeof(*kf));
if (!error) {
if (where == NULL)
@@ -1451,7 +1451,7 @@ again:
}
err:
if (kproc)
- free(kproc, M_TEMP, 0);
+ free(kproc, M_TEMP, sizeof(*kproc));
return (error);
}
@@ -1732,7 +1732,7 @@ more:
out:
uvmspace_free(vm);
- free(buf, M_TEMP, 0);
+ free(buf, M_TEMP, PAGE_SIZE);
return (error);
}
@@ -1796,7 +1796,7 @@ sysctl_proc_cwd(int *name, u_int namelen, void *oldp, size_t *oldlenp,
}
vrele(vp);
- free(path, M_TEMP, 0);
+ free(path, M_TEMP, len);
return (error);
}
@@ -2095,7 +2095,7 @@ sysctl_sensors(int *name, u_int namelen, void *oldp, size_t *oldlenp,
ret = sysctl_rdstruct(oldp, oldlenp, newp, usd,
sizeof(struct sensordev));
- free(usd, M_TEMP, 0);
+ free(usd, M_TEMP, sizeof(*usd));
return (ret);
}
@@ -2118,7 +2118,7 @@ sysctl_sensors(int *name, u_int namelen, void *oldp, size_t *oldlenp,
ret = sysctl_rdstruct(oldp, oldlenp, newp, us,
sizeof(struct sensor));
- free(us, M_TEMP, 0);
+ free(us, M_TEMP, sizeof(*us));
return (ret);
}
diff --git a/sys/kern/kern_task.c b/sys/kern/kern_task.c
index 39f17370b32..51d12200007 100644
--- a/sys/kern/kern_task.c
+++ b/sys/kern/kern_task.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_task.c,v 1.11 2014/10/08 15:28:39 blambert Exp $ */
+/* $OpenBSD: kern_task.c,v 1.12 2014/11/01 23:58:28 tedu Exp $ */
/*
* Copyright (c) 2013 David Gwynne <dlg@openbsd.org>
@@ -129,7 +129,7 @@ taskq_destroy(struct taskq *tq)
}
mtx_leave(&tq->tq_mtx);
- free(tq, M_DEVBUF, 0);
+ free(tq, M_DEVBUF, sizeof(*tq));
}
void
@@ -143,7 +143,7 @@ taskq_create_thread(void *arg)
switch (tq->tq_state) {
case TQ_S_DESTROYED:
mtx_leave(&tq->tq_mtx);
- free(tq, M_DEVBUF, 0);
+ free(tq, M_DEVBUF, sizeof(*tq));
return;
case TQ_S_CREATED:
diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c
index c98c225476b..7306c3e73ec 100644
--- a/sys/kern/kern_tc.c
+++ b/sys/kern/kern_tc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_tc.c,v 1.26 2014/09/14 14:17:25 jsg Exp $ */
+/* $OpenBSD: kern_tc.c,v 1.27 2014/11/01 23:58:28 tedu Exp $ */
/*
* Copyright (c) 2000 Poul-Henning Kamp <phk@FreeBSD.org>
@@ -541,7 +541,7 @@ sysctl_tc_choice(void *oldp, size_t *oldlenp, void *newp, size_t newlen)
strlcat(choices, buf, maxlen);
}
error = sysctl_rdstring(oldp, oldlenp, newp, choices);
- free(choices, M_TEMP, 0);
+ free(choices, M_TEMP, maxlen);
return (error);
}
diff --git a/sys/kern/kern_workq.c b/sys/kern/kern_workq.c
index 9aabaf7249e..228080d59a9 100644
--- a/sys/kern/kern_workq.c
+++ b/sys/kern/kern_workq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_workq.c,v 1.16 2014/10/08 15:28:39 blambert Exp $ */
+/* $OpenBSD: kern_workq.c,v 1.17 2014/11/01 23:58:28 tedu Exp $ */
/*
* Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
@@ -116,7 +116,7 @@ workq_destroy(struct workq *wq)
}
mtx_leave(&wq->wq_mtx);
- free(wq, M_DEVBUF, 0);
+ free(wq, M_DEVBUF, sizeof(*wq));
}
int
@@ -164,7 +164,7 @@ workq_create_thread(void *arg)
switch (wq->wq_state) {
case WQ_S_DESTROYED:
mtx_leave(&wq->wq_mtx);
- free(wq, M_DEVBUF, 0);
+ free(wq, M_DEVBUF, sizeof(*wq));
return;
case WQ_S_CREATED: