From: "F.A.Sulaiman" <asha.16@itfac.mrt.ac.lk>
To: gregkh@linuxfoundation.org
Cc: devel@driverdev.osuosl.org,
"F.A.Sulaiman" <asha.16@itfac.mrt.ac.lk>,
linux-kernel@vger.kernel.org
Subject: [PATCH] staging: rtl8723bs: fix memory leak error
Date: Tue, 31 Aug 2021 01:03:55 +0530 [thread overview]
Message-ID: <20210830193355.11338-1-asha.16@itfac.mrt.ac.lk> (raw)
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
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
reply other threads:[~2021-08-30 19:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210830193355.11338-1-asha.16@itfac.mrt.ac.lk \
--to=asha.16@itfac.mrt.ac.lk \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).