summaryrefslogtreecommitdiff
path: root/sys/dev/sbus/cs4231.c
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-11-09 14:30:44 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-11-09 14:30:44 +0000
commitbf2b4eccef4fa08824ea178bf30d6734a6a62ccb (patch)
tree0feda343a5a548c72e4d3f991d301e2fbd2702a0 /sys/dev/sbus/cs4231.c
parentbdfe5bfc6ba6f84c4341a8e40d118f03e2f66e5b (diff)
Always free memory on failure in c{e,s}4231_alloc(); from Patrick Lafiti.
Diffstat (limited to 'sys/dev/sbus/cs4231.c')
-rw-r--r--sys/dev/sbus/cs4231.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/sbus/cs4231.c b/sys/dev/sbus/cs4231.c
index 6b4e9177256..05e9738500d 100644
--- a/sys/dev/sbus/cs4231.c
+++ b/sys/dev/sbus/cs4231.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cs4231.c,v 1.22 2004/09/29 19:17:43 miod Exp $ */
+/* $OpenBSD: cs4231.c,v 1.23 2004/11/09 14:30:43 miod Exp $ */
/*
* Copyright (c) 1999 Jason L. Wright (jason@thought.net)
@@ -1434,7 +1434,7 @@ cs4231_alloc(void *vsc, int direction, size_t size, int pool, int flags)
p = (struct cs_dma *)malloc(sizeof(struct cs_dma), pool, flags);
if (p == NULL)
- goto fail;
+ return (NULL);
if (bus_dmamap_create(dmat, size, 1, size, 0,
BUS_DMA_NOWAIT, &p->dmamap) != 0)
@@ -1466,6 +1466,7 @@ fail2:
fail1:
bus_dmamap_destroy(dmat, p->dmamap);
fail:
+ free(p, pool);
return (NULL);
}