diff options
Diffstat (limited to 'src/iphone.c')
| -rw-r--r-- | src/iphone.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/iphone.c b/src/iphone.c index 2bdb5c8..ecbb751 100644 --- a/src/iphone.c +++ b/src/iphone.c | |||
| @@ -36,7 +36,6 @@ extern int debug; | |||
| 36 | */ | 36 | */ |
| 37 | iPhone *get_iPhone() { | 37 | iPhone *get_iPhone() { |
| 38 | iPhone *phone = (iPhone*)malloc(sizeof(iPhone)); | 38 | iPhone *phone = (iPhone*)malloc(sizeof(iPhone)); |
| 39 | usbmux_version_header *version = version_header(); | ||
| 40 | struct usb_bus *bus, *busses; | 39 | struct usb_bus *bus, *busses; |
| 41 | struct usb_device *dev; | 40 | struct usb_device *dev; |
| 42 | 41 | ||
| @@ -79,6 +78,7 @@ iPhone *get_iPhone() { | |||
| 79 | 78 | ||
| 80 | // Send the version command to the phone | 79 | // Send the version command to the phone |
| 81 | int bytes = 0; | 80 | int bytes = 0; |
| 81 | usbmux_version_header *version = version_header(); | ||
| 82 | bytes = usb_bulk_write(phone->device, BULKOUT, (char*)version, sizeof(*version), 800); | 82 | bytes = usb_bulk_write(phone->device, BULKOUT, (char*)version, sizeof(*version), 800); |
| 83 | if (bytes < 20 && debug) { | 83 | if (bytes < 20 && debug) { |
| 84 | fprintf(stderr, "get_iPhone(): libusb did NOT send enough!\n"); | 84 | fprintf(stderr, "get_iPhone(): libusb did NOT send enough!\n"); |
| @@ -93,6 +93,7 @@ iPhone *get_iPhone() { | |||
| 93 | 93 | ||
| 94 | // Check for bad response | 94 | // Check for bad response |
| 95 | if (bytes < 20) { | 95 | if (bytes < 20) { |
| 96 | free(version); | ||
| 96 | free_iPhone(phone); | 97 | free_iPhone(phone); |
| 97 | free(version); | 98 | free(version); |
| 98 | if (debug) fprintf(stderr, "get_iPhone(): Invalid version message -- header too short.\n"); | 99 | if (debug) fprintf(stderr, "get_iPhone(): Invalid version message -- header too short.\n"); |
| @@ -114,7 +115,6 @@ iPhone *get_iPhone() { | |||
| 114 | if (debug) fprintf(stderr, "get_iPhone(): Received a bad header/invalid version number."); | 115 | if (debug) fprintf(stderr, "get_iPhone(): Received a bad header/invalid version number."); |
| 115 | return NULL; | 116 | return NULL; |
| 116 | } | 117 | } |
| 117 | |||
| 118 | 118 | ||
| 119 | // If it got to this point it's gotta be bad | 119 | // If it got to this point it's gotta be bad |
| 120 | if (debug) fprintf(stderr, "get_iPhone(): Unknown error.\n"); | 120 | if (debug) fprintf(stderr, "get_iPhone(): Unknown error.\n"); |
