diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2014-03-17 04:11:00 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2014-03-17 04:11:00 +0000 |
commit | 319b10eab9e73cee85a7383c2a503f9363277bfc (patch) | |
tree | 2b77d8c7d16f92da4d3d773d5f94f7a3b54ffced | |
parent | d9a32e24e4cef9e2b4ed7784c25b294bc94b3e90 (diff) |
fix memory leaks in error paths when setting up the gatt
ok kettenis@
-rw-r--r-- | sys/dev/pci/agp.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/dev/pci/agp.c b/sys/dev/pci/agp.c index 57b41c709c7..8f079e27ab2 100644 --- a/sys/dev/pci/agp.c +++ b/sys/dev/pci/agp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agp.c,v 1.40 2014/03/16 13:57:28 kettenis Exp $ */ +/* $OpenBSD: agp.c,v 1.41 2014/03/17 04:10:59 jsg Exp $ */ /*- * Copyright (c) 2000 Doug Rabson * All rights reserved. @@ -240,13 +240,16 @@ agp_alloc_gatt(bus_dma_tag_t dmat, u_int32_t apsize) gatt->ag_size = entries * sizeof(u_int32_t); if (agp_alloc_dmamem(dmat, gatt->ag_size, &gatt->ag_dmamap, - &gatt->ag_physical, &gatt->ag_dmaseg) != 0) + &gatt->ag_physical, &gatt->ag_dmaseg) != 0) { + free(gatt, M_AGP); return (NULL); + } if (bus_dmamem_map(dmat, &gatt->ag_dmaseg, 1, gatt->ag_size, (caddr_t *)&gatt->ag_virtual, BUS_DMA_NOWAIT) != 0) { agp_free_dmamem(dmat, gatt->ag_size, gatt->ag_dmamap, &gatt->ag_dmaseg); + free(gatt, M_AGP); return (NULL); } |