From 43ae418752b30738a7bd3fd5beb55b9476697022 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Thu, 10 Feb 2022 08:46:14 +0100 Subject: [PATCH] Fix USB device leak on connection error If sc_usb_connect() failed, then the sc_usb_device was never destroyed. The assignment was mistakenly removed by commit 61969aeb80093d0777c7716a61698cbdaf9ddd71. --- app/src/usb/scrcpy_otg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/usb/scrcpy_otg.c b/app/src/usb/scrcpy_otg.c index 9a7e3fe6..d3a45679 100644 --- a/app/src/usb/scrcpy_otg.c +++ b/app/src/usb/scrcpy_otg.c @@ -89,6 +89,8 @@ scrcpy_otg(struct scrcpy_options *options) { goto end; } + usb_device_initialized = true; + LOGI("USB device: %s (%04" PRIx16 ":%04" PRIx16 ") %s %s", usb_device.serial, usb_device.vid, usb_device.pid, usb_device.manufacturer, usb_device.product);