Pārlūkot izejas kodu

IB/ipath: Fix memory leak in init_shadow_tids() error path

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@cisco.com>
Roland Dreier 17 gadi atpakaļ
vecāks
revīzija
71c4512201
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1 1
      drivers/infiniband/hw/ipath/ipath_init_chip.c

+ 1 - 1
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;
 	}