summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2015-12-17 17:16:05 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2015-12-17 17:16:05 +0000
commit669b0af03e15b3cc00306d77579b1d0d3ce2a7c3 (patch)
tree61c8efddeb7b086aa97da2c57fd7675e5d7b38c5 /sys
parente20a72bd984f169efe4ef771d37cbfe3c5323d38 (diff)
add a size to free. from Mathieu
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/amd64/amd64/bus_dma.c9
-rw-r--r--sys/arch/i386/i386/bus_dma.c9
2 files changed, 12 insertions, 6 deletions
diff --git a/sys/arch/amd64/amd64/bus_dma.c b/sys/arch/amd64/amd64/bus_dma.c
index b7b7e7f3860..8eaa2e7dba4 100644
--- a/sys/arch/amd64/amd64/bus_dma.c
+++ b/sys/arch/amd64/amd64/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.48 2015/01/27 05:10:30 dlg Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.49 2015/12/17 17:16:04 tedu Exp $ */
/* $NetBSD: bus_dma.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */
/*-
@@ -149,8 +149,11 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
void
_bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
{
-
- free(map, M_DEVBUF, 0);
+ size_t mapsize;
+
+ mapsize = sizeof(struct bus_dmamap) +
+ (sizeof(bus_dma_segment_t) * (map->_dm_segcnt - 1));
+ free(map, M_DEVBUF, mapsize);
}
/*
diff --git a/sys/arch/i386/i386/bus_dma.c b/sys/arch/i386/i386/bus_dma.c
index 5026980388c..0412ea6dcfa 100644
--- a/sys/arch/i386/i386/bus_dma.c
+++ b/sys/arch/i386/i386/bus_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bus_dma.c,v 1.34 2015/01/24 15:13:55 kettenis Exp $ */
+/* $OpenBSD: bus_dma.c,v 1.35 2015/12/17 17:16:04 tedu Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -131,8 +131,11 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_size_t size, int nsegments,
void
_bus_dmamap_destroy(bus_dma_tag_t t, bus_dmamap_t map)
{
-
- free(map, M_DEVBUF, 0);
+ size_t mapsize;
+
+ mapsize = sizeof(struct bus_dmamap) +
+ (sizeof(bus_dma_segment_t) * (map->_dm_segcnt - 1));
+ free(map, M_DEVBUF, mapsize);
}
/*