Elizabeth Figura (@zfigura) commented about dlls/bluetoothapis/main.c:
- if (list->numOfDevices == 1)
- {
*devices = list;
return TRUE;
- }
- size = sizeof( *list ) + (list->numOfDevices - 1) * sizeof( list->deviceList[0] );
- ptr = realloc( list, size );
- if (!ptr)
- {
free( list );
SetLastError( ERROR_OUTOFMEMORY );
return FALSE;
- }
- list = ptr;
- success = DeviceIoControl( radio, IOCTL_BTH_GET_DEVICE_INFO, list, sizeof( *list ), list, size, &bytes, NULL );
Can't the number of devices change between the two calls? I would assume we don't want to fail in that case; we should probably be performing a loop.