summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2015-01-19 06:27:57 +0000
committerdlg <dlg@openbsd.org>2015-01-19 06:27:57 +0000
commitb0eecd7ac065e56de0cf7fb0bed75accd472adb1 (patch)
tree7c6ef391f7530c086c4626c5f1a753f8b02858e8
parentbe a bit more careful in these tests to ensure that (diff)
downloadwireguard-openbsd-b0eecd7ac065e56de0cf7fb0bed75accd472adb1.tar.xz
wireguard-openbsd-b0eecd7ac065e56de0cf7fb0bed75accd472adb1.zip
pass the size of the softc to free.
ok deraadt@
-rw-r--r--sys/kern/subr_autoconf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/subr_autoconf.c b/sys/kern/subr_autoconf.c
index 00b988e7c29..7bb3acec49f 100644
--- a/sys/kern/subr_autoconf.c
+++ b/sys/kern/subr_autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_autoconf.c,v 1.80 2014/09/18 18:54:29 kettenis Exp $ */
+/* $OpenBSD: subr_autoconf.c,v 1.81 2015/01/19 06:27:57 dlg Exp $ */
/* $NetBSD: subr_autoconf.c,v 1.21 1996/04/04 06:06:18 cgd Exp $ */
/*
@@ -935,8 +935,10 @@ device_ref(struct device *dv)
void
device_unref(struct device *dv)
{
+ struct cfattach *ca = dv->dv_cfdata->cf_attach;
+
dv->dv_ref--;
if (dv->dv_ref == 0) {
- free(dv, M_DEVBUF, 0);
+ free(dv, M_DEVBUF, ca->ca_devsize);
}
}