]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdbserver/inferiors.cc
Fix undefined behavior in gdbserver
[thirdparty/binutils-gdb.git] / gdbserver / inferiors.cc
index 861c9f3e338f9e2ad7a0e562e669ceb27adfd8a5..9a1280d039b42f847fe51bd87a3e77345fad7222 100644 (file)
@@ -103,9 +103,9 @@ remove_thread (struct thread_info *thread)
 
   discard_queued_stop_replies (ptid_of (thread));
   all_threads.remove (thread);
-  free_one_thread (thread);
   if (current_thread == thread)
     current_thread = NULL;
+  free_one_thread (thread);
 }
 
 void *