Free the newtag if we exit with a failure from alloc_bounce_zone().

Found by: Coverity Prevent(tm)
This commit is contained in:
Scott Long 2006-01-14 17:22:47 +00:00
parent 34f83c52e7
commit 0af57729a6
2 changed files with 9 additions and 2 deletions

View File

@ -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) {

View File

@ -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) {