diff options
Diffstat (limited to 'src/iphone.c')
-rw-r--r-- | src/iphone.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/iphone.c b/src/iphone.c index 6eb56f7..5076b48 100644 --- a/src/iphone.c +++ b/src/iphone.c @@ -95,7 +95,7 @@ static void iphone_config_usb_device(iphone_device_t phone) * descriptor on return. * @return IPHONE_E_SUCCESS if ok, otherwise an error code. */ -static iphone_error_t iphone_get_specific_device(unsigned int bus_n, int dev_n, iphone_device_t * device) +iphone_error_t iphone_get_specific_device(unsigned int bus_n, int dev_n, iphone_device_t * device) { struct usb_bus *bus, *busses; struct usb_device *dev; @@ -230,13 +230,15 @@ iphone_error_t iphone_free_device(iphone_device_t device) unsigned char buf[512]; // read final package(s) - do { - bytes = usb_bulk_read(device->device, BULKIN, (void *) &buf, 512, 800); - if (bytes > 0) { - log_debug_msg("iphone_free_device: final read returned\n"); - log_debug_buffer(buf, bytes); - } - } while (bytes > 0); + if (device->device != NULL) { + do { + bytes = usb_bulk_read(device->device, BULKIN, (void *) &buf, 512, 800); + if (bytes > 0) { + log_debug_msg("iphone_free_device: final read returned\n"); + log_debug_buffer(buf, bytes); + } + } while (bytes > 0); + } if (device->buffer) { free(device->buffer); |