diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/NotificationProxy.c | 1 | ||||
-rw-r--r-- | src/iphone.c | 18 |
2 files changed, 11 insertions, 8 deletions
diff --git a/src/NotificationProxy.c b/src/NotificationProxy.c index 726852e..bf837bf 100644 --- a/src/NotificationProxy.c +++ b/src/NotificationProxy.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include <string.h> #include <stdio.h> #include <plist/plist.h> #include "NotificationProxy.h" 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); |