From: Bryan O'Sullivan Date: Thu, 28 Sep 2006 15:59:58 +0000 (-0700) Subject: IB/ipath: Fix memory leak if allocation fails X-Git-Tag: v2.6.19-rc1~652^2~25 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=221e31985b490309eb9ae33ac815deae3b5aa021;p=linux-2.6-omap-h63xx.git IB/ipath: Fix memory leak if allocation fails If the second allocation failed, the first structure allocated in this routine was not freed. Signed-off-by: Bryan O'Sullivan Signed-off-by: Roland Dreier --- diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c index 2108466c7e3..a01301d0753 100644 --- a/drivers/infiniband/hw/ipath/ipath_driver.c +++ b/drivers/infiniband/hw/ipath/ipath_driver.c @@ -1326,6 +1326,9 @@ int ipath_create_rcvhdrq(struct ipath_devdata *dd, "for port %u rcvhdrqtailaddr failed\n", pd->port_port); ret = -ENOMEM; + dma_free_coherent(&dd->pcidev->dev, amt, + pd->port_rcvhdrq, pd->port_rcvhdrq_phys); + pd->port_rcvhdrq = NULL; goto bail; } pd->port_rcvhdrqtailaddr_phys = phys_hdrqtail;