summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2006-01-14 17:22:47 +0000
committerscottl <scottl@FreeBSD.org>2006-01-14 17:22:47 +0000
commitec415604ac113037fe5565b05ca713ac76ee24eb (patch)
tree08f0b7d2919b668976fe776ee445a6c6d24e8cf7
parent33105fb85b141bdf4833ddf81ee6acd5ed0f700a (diff)
downloadFreeBSD-src-ec415604ac113037fe5565b05ca713ac76ee24eb.zip
FreeBSD-src-ec415604ac113037fe5565b05ca713ac76ee24eb.tar.gz
Free the newtag if we exit with a failure from alloc_bounce_zone().
Found by: Coverity Prevent(tm)
-rw-r--r--sys/amd64/amd64/busdma_machdep.c4
-rw-r--r--sys/i386/i386/busdma_machdep.c7
2 files changed, 9 insertions, 2 deletions
diff --git a/sys/amd64/amd64/busdma_machdep.c b/sys/amd64/amd64/busdma_machdep.c
index 199ab54..1d70417 100644
--- a/sys/amd64/amd64/busdma_machdep.c
+++ b/sys/amd64/amd64/busdma_machdep.c
@@ -285,8 +285,10 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
/* Must bounce */
- if ((error = alloc_bounce_zone(newtag)) != 0)
+ if ((error = alloc_bounce_zone(newtag)) != 0) {
+ free(newtag, M_DEVBUF);
return (error);
+ }
bz = newtag->bounce_zone;
if (ptoa(bz->total_bpages) < maxsize) {
diff --git a/sys/i386/i386/busdma_machdep.c b/sys/i386/i386/busdma_machdep.c
index c4af1dd..08db5e0 100644
--- a/sys/i386/i386/busdma_machdep.c
+++ b/sys/i386/i386/busdma_machdep.c
@@ -28,6 +28,9 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/kdb.h>
+#include <ddb/ddb.h>
+#include <ddb/db_output.h>
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/bus.h>
@@ -285,8 +288,10 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
/* Must bounce */
- if ((error = alloc_bounce_zone(newtag)) != 0)
+ if ((error = alloc_bounce_zone(newtag)) != 0) {
+ free(newtag, M_DEVBUF);
return (error);
+ }
bz = newtag->bounce_zone;
if (ptoa(bz->total_bpages) < maxsize) {
OpenPOWER on IntegriCloud