Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 766a957d authored by Christophe Jaillet's avatar Christophe Jaillet Committed by David S. Miller
Browse files

qlcnic: Fix a memory leak in error handling path



If 'dma_alloc_coherent()' fails, we should release resources allocated so
far, just as done in all other cases in this function.

Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 177c8d1c
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -573,8 +573,10 @@ int qlcnic_alloc_hw_resources(struct qlcnic_adapter *adapter)
		ptr = (__le32 *)dma_alloc_coherent(&pdev->dev, sizeof(u32),
						   &tx_ring->hw_cons_phys_addr,
						   GFP_KERNEL);
		if (ptr == NULL)
			return -ENOMEM;
		if (ptr == NULL) {
			err = -ENOMEM;
			goto err_out_free;
		}

		tx_ring->hw_consumer = ptr;
		/* cmd desc ring */