All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: fix memory leak error
@ 2021-08-30 19:33 ` F.A.Sulaiman
  0 siblings, 0 replies; 8+ messages in thread
From: F.A.Sulaiman @ 2021-08-30 19:33 UTC (permalink / raw)
  To: gregkh; +Cc: F.A.Sulaiman, devel, linux-kernel

Smatch reported memory leak bug in rtl8723b_FirmwareDownload function. 
The problem is pFirmware memory is not released in release_fw1. 
Instead of redirecting to release_fw1 we can turn it into exit 
and free the memory.

Signed-off-by: F.A. SULAIMAN <asha.16@itfac.mrt.ac.lk>
---
 drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
index de8caa6cd418..b59c2aa3a9d8 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
@@ -436,7 +436,7 @@ s32 rtl8723b_FirmwareDownload(struct adapter *padapter, bool  bUsedWoWLANFw)
 	if (pFirmware->fw_length > FW_8723B_SIZE) {
 		rtStatus = _FAIL;
 		DBG_871X_LEVEL(_drv_emerg_, "Firmware size:%u exceed %u\n", pFirmware->fw_length, FW_8723B_SIZE);
-		goto release_fw1;
+		goto exit;
 	}
 
 	pFirmwareBuf = pFirmware->fw_buffer_sz;
@@ -512,7 +512,6 @@ s32 rtl8723b_FirmwareDownload(struct adapter *padapter, bool  bUsedWoWLANFw)
 exit:
 	kfree(pFirmware->fw_buffer_sz);
 	kfree(pFirmware);
-release_fw1:
 	kfree(pBTFirmware);
 	DBG_871X(" <=== rtl8723b_FirmwareDownload()\n");
 	return rtStatus;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-01-06 21:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-30 19:33 [PATCH] staging: rtl8723bs: fix memory leak error F.A.Sulaiman
2021-08-30 19:33 ` F.A.Sulaiman
2021-08-31  8:47 ` Dan Carpenter
2021-09-01 18:54   ` F.A. SULAIMAN
2022-01-05 12:34 ` [PATCH v2] " F.A.Sulaiman
2022-01-05 14:37   ` Dan Carpenter
2022-01-06 21:00   ` kernel test robot
2022-01-06 21:00     ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.