summaryrefslogtreecommitdiffstats
path: root/src/dfu.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2012-07-17 19:09:18 +0200
committerGravatar Nikias Bassen2012-07-17 19:09:18 +0200
commit6eaa958116963e509722363ca5c278940e896c7f (patch)
treea6d5e60e61c97d532b77414631d97f7cddab908f /src/dfu.c
parente79d523de9b25d2995920fa532af31be29a14f29 (diff)
downloadidevicerestore-6eaa958116963e509722363ca5c278940e896c7f.tar.gz
idevicerestore-6eaa958116963e509722363ca5c278940e896c7f.tar.bz2
dfu: make sure client member of struct is NULLed correctly
Diffstat (limited to 'src/dfu.c')
-rw-r--r--src/dfu.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/dfu.c b/src/dfu.c
index 21c6366..7d5b0eb 100644
--- a/src/dfu.c
+++ b/src/dfu.c
@@ -122,6 +122,7 @@ int dfu_send_buffer(struct idevicerestore_client_t* client, char* buffer, uint32
if (error != IRECV_E_SUCCESS) {
error("ERROR: Unable to reset device\n");
irecv_close(client->dfu->client);
+ client->dfu->client = NULL;
return -1;
}
@@ -247,6 +248,7 @@ int dfu_enter_recovery(struct idevicerestore_client_t* client, plist_t build_ide
if (dfu_send_component(client, build_identity, "iBSS") < 0) {
error("ERROR: Unable to send iBSS to device\n");
irecv_close(client->dfu->client);
+ client->dfu->client = NULL;
return -1;
}
@@ -256,6 +258,7 @@ int dfu_enter_recovery(struct idevicerestore_client_t* client, plist_t build_ide
if (dfu_error != IRECV_E_SUCCESS) {
error("ERROR: Unable to reset device\n");
irecv_close(client->dfu->client);
+ client->dfu->client = NULL;
return -1;
}
@@ -314,6 +317,7 @@ int dfu_enter_recovery(struct idevicerestore_client_t* client, plist_t build_ide
if (dfu_send_component(client, build_identity, "iBEC") < 0) {
error("ERROR: Unable to send iBEC to device\n");
irecv_close(client->dfu->client);
+ client->dfu->client = NULL;
return -1;
}
@@ -323,6 +327,7 @@ int dfu_enter_recovery(struct idevicerestore_client_t* client, plist_t build_ide
if (dfu_error != IRECV_E_SUCCESS) {
error("ERROR: Unable to reset device\n");
irecv_close(client->dfu->client);
+ client->dfu->client = NULL;
return -1;
}
}
@@ -334,8 +339,10 @@ int dfu_enter_recovery(struct idevicerestore_client_t* client, plist_t build_ide
// Reconnect to device, but this time make sure we're not still in DFU mode
if (recovery_client_new(client) < 0 || client->recovery->client->mode == kDfuMode) {
error("ERROR: Unable to connect to recovery device\n");
- if (client->recovery->client)
+ if (client->recovery->client) {
irecv_close(client->recovery->client);
+ client->recovery->client = NULL;
+ }
return -1;
}
return 0;