* [PATCH 3/3] staging: rtl8188eu: add release_firmware() between request_firmware and function error exit
@ 2016-02-11 18:25 Ivan Safonov
0 siblings, 0 replies; only message in thread
From: Ivan Safonov @ 2016-02-11 18:25 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Ivan Safonov, Dan Carpenter, Vatika Harlalka, Amitoj Kaur Chawla,
devel, linux-kernel
Small memory leak fixed.
Signed-off-by: Ivan Safonov <insafonov@gmail.com>
---
drivers/staging/rtl8188eu/hal/fw.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8188eu/hal/fw.c b/drivers/staging/rtl8188eu/hal/fw.c
index 55c17df..656133c 100644
--- a/drivers/staging/rtl8188eu/hal/fw.c
+++ b/drivers/staging/rtl8188eu/hal/fw.c
@@ -175,14 +175,17 @@ int rtl88eu_download_fw(struct adapter *adapt)
if (fw->size > FW_8188E_SIZE) {
dev_err(device, "Firmware size exceed 0x%X. Check it.\n",
FW_8188E_SIZE);
+ release_firmware(fw);
return -1;
}
trailing_zeros_length = (4 - fw->size % 4) % 4;
fw_data = kmalloc(fw->size + trailing_zeros_length, GFP_KERNEL);
- if (!fw_data)
+ if (!fw_data) {
+ release_firmware(fw);
return -ENOMEM;
+ }
memcpy(fw_data, fw->data, fw->size);
memset(fw_data + fw->size, 0, trailing_zeros_length);
--
2.4.10
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-02-11 18:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-11 18:25 [PATCH 3/3] staging: rtl8188eu: add release_firmware() between request_firmware and function error exit Ivan Safonov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®