[ofa-general] [PATCH] IB/ipath: Fix memory leak in init_shadow_tids() error path

Roland Dreier rdreier at cisco.com
Sun Feb 22 20:05:19 PST 2009


If the second vmalloc() fails, the wrong pointer is pased to vfree(), so
the first vmalloc() ends up getting leaked.

This was spotted by the Coverity checker (CID 2709).

Signed-off-by: Roland Dreier <rolandd at cisco.com>
---
Unless someone objects I'll merge this for 2.6.30.

 drivers/infiniband/hw/ipath/ipath_init_chip.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/hw/ipath/ipath_init_chip.c b/drivers/infiniband/hw/ipath/ipath_init_chip.c
index 64aeefb..077879c 100644
--- a/drivers/infiniband/hw/ipath/ipath_init_chip.c
+++ b/drivers/infiniband/hw/ipath/ipath_init_chip.c
@@ -455,7 +455,7 @@ static void init_shadow_tids(struct ipath_devdata *dd)
 	if (!addrs) {
 		ipath_dev_err(dd, "failed to allocate shadow dma handle "
 			      "array, no expected sends!\n");
-		vfree(dd->ipath_pageshadow);
+		vfree(pages);
 		dd->ipath_pageshadow = NULL;
 		return;
 	}
-- 
1.6.0.4




More information about the general mailing list