diff options
| author | 2010-05-24 04:24:24 -0400 | |
|---|---|---|
| committer | 2010-05-24 04:24:24 -0400 | |
| commit | 77df9a41d90ac645d69aa86dd9bb9ee09a9fb735 (patch) | |
| tree | d1aa61354ee79cfae63dca318587dfe48581a4b1 /src/libirecovery.c | |
| parent | 53142922b14fe36f950eb28d3b42683ddedb7669 (diff) | |
| download | libirecovery-77df9a41d90ac645d69aa86dd9bb9ee09a9fb735.tar.gz libirecovery-77df9a41d90ac645d69aa86dd9bb9ee09a9fb735.tar.bz2 | |
Finally tracked down and killed that damn bug!!
Diffstat (limited to 'src/libirecovery.c')
| -rw-r--r-- | src/libirecovery.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/libirecovery.c b/src/libirecovery.c index 131032c..f4d1cca 100644 --- a/src/libirecovery.c +++ b/src/libirecovery.c | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | int irecv_default_sender(irecv_client_t client, unsigned char* data, int size); | 30 | int irecv_default_sender(irecv_client_t client, unsigned char* data, int size); |
| 31 | int irecv_default_receiver(irecv_client_t client, unsigned char* data, int size); | 31 | int irecv_default_receiver(irecv_client_t client, unsigned char* data, int size); |
| 32 | 32 | ||
| 33 | irecv_error_t irecv_open(irecv_client_t* pclient, const char* uuid) { | 33 | irecv_error_t irecv_open(irecv_client_t* pclient) { |
| 34 | int i = 0; | 34 | int i = 0; |
| 35 | char serial[256]; | 35 | char serial[256]; |
| 36 | struct libusb_device* usb_device = NULL; | 36 | struct libusb_device* usb_device = NULL; |
| @@ -63,16 +63,15 @@ irecv_error_t irecv_open(irecv_client_t* pclient, const char* uuid) { | |||
| 63 | } | 63 | } |
| 64 | libusb_set_debug(usb_context, 3); | 64 | libusb_set_debug(usb_context, 3); |
| 65 | 65 | ||
| 66 | /* identified a valid recovery device */ | 66 | libusb_free_device_list(usb_device_list, 0); |
| 67 | libusb_free_device_list(usb_device_list, 1); | ||
| 68 | 67 | ||
| 69 | irecv_client_t client = (irecv_client_t) malloc(sizeof(irecv_client_t)); | 68 | irecv_client_t client = (irecv_client_t) malloc(sizeof(struct irecv_client)); |
| 70 | if (client == NULL) { | 69 | if (client == NULL) { |
| 71 | libusb_close(usb_handle); | 70 | libusb_close(usb_handle); |
| 72 | libusb_exit(usb_context); | 71 | libusb_exit(usb_context); |
| 73 | return IRECV_E_OUT_OF_MEMORY; | 72 | return IRECV_E_OUT_OF_MEMORY; |
| 74 | } | 73 | } |
| 75 | memset(client, '\0', sizeof(irecv_client_t)); | 74 | memset(client, '\0', sizeof(struct irecv_client)); |
| 76 | client->interface = -1; | 75 | client->interface = -1; |
| 77 | client->handle = usb_handle; | 76 | client->handle = usb_handle; |
| 78 | client->context = usb_context; | 77 | client->context = usb_context; |
| @@ -154,7 +153,7 @@ irecv_error_t irecv_close(irecv_client_t client) { | |||
| 154 | } | 153 | } |
| 155 | 154 | ||
| 156 | if (client->context != NULL) { | 155 | if (client->context != NULL) { |
| 157 | libusb_exit(client->context); | 156 | libusb_exit(NULL); |
| 158 | client->context = NULL; | 157 | client->context = NULL; |
| 159 | } | 158 | } |
| 160 | 159 | ||
