From f099161e3c01546d6a296fe10c59e341c679871c Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Sun, 5 Nov 2017 16:14:53 +0100 Subject: restore: Prevent crash in fdr_disconnect() when exiting unexpectedly --- src/restore.c | 8 ++++---- 1 file 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); -- cgit v1.1-32-gdbae