staging: rtl8188eu: add release_firmware() between request_firmware and function...
authorIvan Safonov <insafonov@gmail.com>
Thu, 11 Feb 2016 18:25:30 +0000 (01:25 +0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 12 Feb 2016 04:03:56 +0000 (20:03 -0800)
Small memory leak fixed.

Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8188eu/hal/fw.c

index 55c17df0e8391bf3b8eba06caf973cacd9ac92a5..656133c47426baa6ce6ad00afa2473ff3e3a4a64 100644 (file)
@@ -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);