Skip to contentSkip to conversation

scsi: qla2xxx: Fix memleak on memory alloc failed

PATCH New Jackie Liu 1 participant 1 message May 26, 2023

Subsystems (2)
lore
Share & tools
lore

Jackie Liu

author
#0 lore raw

PATCH 1/1 scsi: qla2xxx: Fix memleak on memory alloc failed

From: Jackie Liu <[email protected]>

Returning directly without free memory can lead to memory leaks, which can be avoided by goto 'fail_dma_pool'.

Fixes 06634d5b6e92 ("scsi: qla2xxx: Return -ENOMEM if kzalloc() fails")
---
 drivers/scsi/qla2xxx/qla_os.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_os.c +1 -1
index 2fa695bf38b7..da7698c8293b 100644
@@ -4245,7 +4245,7 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
 					ql_dbg_pci(ql_dbg_init, ha->pdev,
 					    0xe0ee, "%s: failed alloc dsd\n",
 					    __func__);
-					return -ENOMEM;
+					goto fail_dma_pool;
 				}
 				ha->dif_bundle_kallocs++;
 
Signature · 1 line
2.25.1