]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Bluetooth: btusb: fix memory leak
authorMuhammad Usama Anjum <musamaanjum@gmail.com>
Tue, 13 Apr 2021 17:52:08 +0000 (22:52 +0500)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 4 May 2021 13:20:30 +0000 (15:20 +0200)
If btusb_mtk_submit_wmt_recv_urb returns error, wc should be freed and
then error should be returned to prevent memory leak.

Addresses-Coverity: ("Prevent memory leak")
Fixes: 4cbb375e997d ("Bluetooth: btusb: Fixed too many in-token issue for Mediatek Chip.")
Signed-off-by: Muhammad Usama Anjum <musamaanjum@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/btusb.c

index 58ae824fb50731b368cd85b1dd2c976286cf0246..2c403188f58620d9a0e7365b65e22cc31ae7500b 100644 (file)
@@ -3324,7 +3324,7 @@ static int btusb_mtk_hci_wmt_sync(struct hci_dev *hdev,
        /* Submit control IN URB on demand to process the WMT event */
        err = btusb_mtk_submit_wmt_recv_urb(hdev);
        if (err < 0)
-               return err;
+               goto err_free_wc;
 
        /* The vendor specific WMT commands are all answered by a vendor
         * specific event and will have the Command Status or Command