mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ivan Safonov <insafonov@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Ivan Safonov <insafonov@gmail.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Vatika Harlalka <vatikaharlalka@gmail.com>,
	Amitoj Kaur Chawla <amitoj1606@gmail.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/3] staging: rtl8188eu: add release_firmware() between request_firmware and function error exit
Date: Fri, 12 Feb 2016 01:25:30 +0700	[thread overview]
Message-ID: <20160211182530.GA3205@alpha.sfu-kras.ru> (raw)

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

                 reply	other threads:[~2016-02-11 18:24 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=20160211182530.GA3205@alpha.sfu-kras.ru \
    --to=insafonov@gmail.com \
    --cc=amitoj1606@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vatikaharlalka@gmail.com \
    /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

all inboxes | Powered by JetHome®