diff options
author | 2014-03-17 04:10:59 +0000 | |
---|---|---|
committer | 2014-03-17 04:10:59 +0000 | |
commit | 371e23368cc7a7f6bd1931630ebfaf3907548411 (patch) | |
tree | 8f4c7f3a982a7dea3b4e9d7f35e1031ddf12fbb4 | |
parent | simplify readmsg loop (diff) | |
download | wireguard-openbsd-371e23368cc7a7f6bd1931630ebfaf3907548411.tar.xz wireguard-openbsd-371e23368cc7a7f6bd1931630ebfaf3907548411.zip |
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); } |