diff options
author | Martin Szulecki | 2009-04-13 05:37:35 +0200 |
---|---|---|
committer | Nikias Bassen | 2009-04-13 05:37:35 +0200 |
commit | 322a3e80835aacc2abaa802545143ebde69d21da (patch) | |
tree | 5a5f6d03eec2767442f1c896de2ebe205539e334 | |
parent | e1751b8c02822da3881b41a8e07a36665a163130 (diff) | |
download | usbmuxd-322a3e80835aacc2abaa802545143ebde69d21da.tar.gz usbmuxd-322a3e80835aacc2abaa802545143ebde69d21da.tar.bz2 |
Check for set usb_device in iphone_free_device to avoid libusb segfault
Signed-off-by: Nikias Bassen <nikias@gmx.li>
-rw-r--r-- | iphone.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -427,9 +427,11 @@ iphone_error_t iphone_free_device(iphone_device_t device) return IPHONE_E_INVALID_ARG; iphone_error_t ret = IPHONE_E_UNKNOWN_ERROR; - do { - bytes = usb_bulk_read(device->device, BULKIN, buf, 512, 800); - } while (bytes > 0); + if (device->device) { + do { + bytes = usb_bulk_read(device->device, BULKIN, buf, 512, 800); + } while (bytes > 0); + } if (device->buffer) { free(device->buffer); |