summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2017-11-05 16:14:53 +0100
committerGravatar Nikias Bassen2017-11-05 16:14:53 +0100
commitf099161e3c01546d6a296fe10c59e341c679871c (patch)
tree6cb8a2462ad9de8db872cd675944b25d12bcd269
parentf9b529b75982902c9b31ee59fe73e2c56b8ba237 (diff)
downloadidevicerestore-f099161e3c01546d6a296fe10c59e341c679871c.tar.gz
idevicerestore-f099161e3c01546d6a296fe10c59e341c679871c.tar.bz2
restore: Prevent crash in fdr_disconnect() when exiting unexpectedly
-rw-r--r--src/restore.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/restore.c b/src/restore.c
index 46e4a0f..ab7e50d 100644
--- a/src/restore.c
+++ b/src/restore.c
@@ -2299,12 +2299,12 @@ int restore_device(struct idevicerestore_client_t* client, plist_t build_identit
message = NULL;
}
- if (fdr_control_channel) {
- fdr_disconnect(fdr_control_channel);
- if (fdr_thread) {
+ if (thread_alive(fdr_thread)) {
+ if (fdr_control_channel) {
+ fdr_disconnect(fdr_control_channel);
thread_join(fdr_thread);
+ fdr_control_channel = NULL;
}
- fdr_control_channel = NULL;
}
restore_client_free(client);