summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2009-11-11 19:35:35 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2009-11-11 19:35:35 +0000
commit1e304a22260a9c0fa19959785c6c3534ec39316f (patch)
tree3f99707518ba3977a9885da5480378a4a6e5b497
parente1c00c8ada2158a08bebd5027946f164593015f8 (diff)
memory leaks found by parfait; ok oga
-rw-r--r--sys/dev/pci/agp_i810.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/dev/pci/agp_i810.c b/sys/dev/pci/agp_i810.c
index 509ba476cc2..c43ec73fa52 100644
--- a/sys/dev/pci/agp_i810.c
+++ b/sys/dev/pci/agp_i810.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: agp_i810.c,v 1.57 2009/06/06 11:11:10 oga Exp $ */
+/* $OpenBSD: agp_i810.c,v 1.58 2009/11/11 19:35:34 deraadt Exp $ */
/*-
* Copyright (c) 2000 Doug Rabson
@@ -620,11 +620,14 @@ agp_i810_alloc_memory(void *softc, int type, vsize_t size)
* get their physical address.
*/
if ((mem->am_dmaseg = malloc(sizeof (*mem->am_dmaseg), M_AGP,
- M_WAITOK | M_CANFAIL)) == NULL)
+ M_WAITOK | M_CANFAIL)) == NULL) {
+ free(mem, M_AGP);
return (NULL);
+ }
if ((error = agp_alloc_dmamem(sc->sc_dmat, size,
&mem->am_dmamap, &mem->am_physical, mem->am_dmaseg)) != 0) {
+ free(mem->am_dmaseg, M_AGP);
free(mem, M_AGP);
printf("agp: agp_alloc_dmamem(%d)\n", error);
return (NULL);