From: Mateusz Kulikowski Date: Sun, 27 Sep 2015 19:48:19 +0000 (+0200) Subject: staging: rtl8723au: Fix resource leak X-Git-Tag: KARO-TX6UL-2015-11-03~34^2~1419 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7d76173d40bef0516068dbf38195470abf979c8a;p=karo-tx-linux.git staging: rtl8723au: Fix resource leak Firmware was not released properly if kmemdup fails. Addresses-Coverity-Id: 1269118 Signed-off-by: Mateusz Kulikowski Acked-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c index cd014f7e6bc3..ecf54ee47f7c 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c @@ -249,13 +249,13 @@ int rtl8723a_FirmwareDownload(struct rtw_adapter *padapter) goto Exit; } firmware_buf = kmemdup(fw->data, fw->size, GFP_KERNEL); + fw_size = fw->size; + release_firmware(fw); if (!firmware_buf) { rtStatus = _FAIL; goto Exit; } buf = firmware_buf; - fw_size = fw->size; - release_firmware(fw); /* To Check Fw header. Added by tynli. 2009.12.04. */ pFwHdr = (struct rt_8723a_firmware_hdr *)firmware_buf;