In function t4_wr_mbox_meat_timeout(), Dynamic memory stored
in 'temp' not free when the functon return, It possible memory
leak.

Signed-off-by: Congwen Zhang <zhang.cong...@zte.com.cn>
---
 drivers/net/cxgbe/base/t4_hw.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.c
index a8ccea0..013d996 100644
--- a/drivers/net/cxgbe/base/t4_hw.c
+++ b/drivers/net/cxgbe/base/t4_hw.c
@@ -403,6 +403,7 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox,
                        t4_os_atomic_list_del(&entry, &adap->mbox_list,
                                              &adap->mbox_lock);
                        t4_report_fw_error(adap);
+                       free(temp);
                        return (pcie_fw & F_PCIE_FW_ERR) ? -ENXIO : -EBUSY;
                }
 
@@ -446,6 +447,7 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox,
                                                         &adap->mbox_list,
                                                         &adap->mbox_lock));
                t4_report_fw_error(adap);
+               free(temp);
                return (v == X_MBOWNER_FW ? -EBUSY : -ETIMEDOUT);
        }
 
@@ -546,6 +548,7 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int mbox,
                        T4_OS_MBOX_LOCKING(
                                t4_os_atomic_list_del(&entry, &adap->mbox_list,
                                                      &adap->mbox_lock));
+                       free(temp);
                        return -G_FW_CMD_RETVAL((int)res);
                }
        }
-- 
1.8.3.1

Reply via email to