]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
IB/ipath: Fix memory leak if allocation fails
authorBryan O'Sullivan <bos@pathscale.com>
Thu, 28 Sep 2006 15:59:58 +0000 (08:59 -0700)
committerRoland Dreier <rolandd@cisco.com>
Thu, 28 Sep 2006 18:16:23 +0000 (11:16 -0700)
If the second allocation failed, the first structure allocated in this
routine was not freed.

Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/ipath/ipath_driver.c

index 2108466c7e337169649c4a64e0f9157995a9aca7..a01301d0753cec154dd3e86f350903a455e4733d 100644 (file)
@@ -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;