net/cxgbe: fix memory leak

In function t4_wr_mbox_meat_timeout(), dynamic memory stored
in 'temp' variable and it is not freed when the function return,
this is a possible memory leak.

Fixes: 3bd122eef2cc ("cxgbe/base: add hardware API for Chelsio T5 series adapters")
Cc: stable@dpdk.org

Signed-off-by: Congwen Zhang <zhang.congwen@zte.com.cn>
Acked-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
This commit is contained in:
Congwen Zhang 2017-09-05 16:46:57 +08:00 committed by Ferruh Yigit
parent 772d34356d
commit c0b865d471

View File

@ -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);
}
}