summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2024-01-04 02:10:57 +0100
committerGravatar GitHub2024-01-04 02:10:57 +0100
commit15fdc6ae46884208ef060dc84e32daa15e20ded8 (patch)
tree52dda0cf7374ff273c2d28857c77ead6ab85524c /src
parent2fff42619eb1bed0c1664c138414320bdb37a486 (diff)
downloadlibirecovery-15fdc6ae46884208ef060dc84e32daa15e20ded8.tar.gz
libirecovery-15fdc6ae46884208ef060dc84e32daa15e20ded8.tar.bz2
win32: Make sure to free device list at the right place
Diffstat (limited to 'src')
-rw-r--r--src/libirecovery.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/libirecovery.c b/src/libirecovery.c
index 0babf1d..7ddb2b5 100644
--- a/src/libirecovery.c
+++ b/src/libirecovery.c
@@ -1089,15 +1089,14 @@ static irecv_error_t win32_open_with_ecid(irecv_client_t* client, uint64_t ecid)
1089{ 1089{
1090 int found = 0; 1090 int found = 0;
1091 const GUID *guids[] = { &GUID_DEVINTERFACE_DFU, &GUID_DEVINTERFACE_IBOOT, NULL }; 1091 const GUID *guids[] = { &GUID_DEVINTERFACE_DFU, &GUID_DEVINTERFACE_IBOOT, NULL };
1092 SP_DEVICE_INTERFACE_DATA currentInterface;
1093 HDEVINFO usbDevices;
1094 DWORD i;
1095 irecv_client_t _client = (irecv_client_t) malloc(sizeof(struct irecv_client_private)); 1092 irecv_client_t _client = (irecv_client_t) malloc(sizeof(struct irecv_client_private));
1096 memset(_client, 0, sizeof(struct irecv_client_private)); 1093 memset(_client, 0, sizeof(struct irecv_client_private));
1097 1094
1098 int k; 1095 int k;
1099 for (k = 0; !found && guids[k]; k++) { 1096 for (k = 0; !found && guids[k]; k++) {
1100 usbDevices = SetupDiGetClassDevs(guids[k], NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE); 1097 DWORD i;
1098 SP_DEVICE_INTERFACE_DATA currentInterface;
1099 HDEVINFO usbDevices = SetupDiGetClassDevs(guids[k], NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
1101 memset(&currentInterface, '\0', sizeof(SP_DEVICE_INTERFACE_DATA)); 1100 memset(&currentInterface, '\0', sizeof(SP_DEVICE_INTERFACE_DATA));
1102 currentInterface.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA); 1101 currentInterface.cbSize = sizeof(SP_DEVICE_INTERFACE_DATA);
1103 for (i = 0; usbDevices && SetupDiEnumDeviceInterfaces(usbDevices, NULL, guids[k], i, &currentInterface); i++) { 1102 for (i = 0; usbDevices && SetupDiEnumDeviceInterfaces(usbDevices, NULL, guids[k], i, &currentInterface); i++) {
@@ -1193,8 +1192,8 @@ static irecv_error_t win32_open_with_ecid(irecv_client_t* client, uint64_t ecid)
1193 found = 1; 1192 found = 1;
1194 break; 1193 break;
1195 } 1194 }
1195 SetupDiDestroyDeviceInfoList(usbDevices);
1196 } 1196 }
1197 SetupDiDestroyDeviceInfoList(usbDevices);
1198 1197
1199 if (!found) { 1198 if (!found) {
1200 irecv_close(_client); 1199 irecv_close(_client);