staging: rtl8723au: Fix resource leak
authorMateusz Kulikowski <mateusz.kulikowski@gmail.com>
Sun, 27 Sep 2015 19:48:19 +0000 (21:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Sep 2015 02:29:02 +0000 (04:29 +0200)
Firmware was not released properly if kmemdup fails.

Addresses-Coverity-Id: 1269118
Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c

index cd014f7e6bc3418e712e4029b66c8ef73e68ccdb..ecf54ee47f7c979e23e97a70fcfbbc4e12729bf5 100644 (file)
@@ -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;