* inferiors.c (find_inferior): Make it safe for the callback
authorPedro Alves <palves@redhat.com>
Sun, 22 Mar 2009 22:34:04 +0000 (22:34 +0000)
committerPedro Alves <palves@redhat.com>
Sun, 22 Mar 2009 22:34:04 +0000 (22:34 +0000)
function to delete the currently iterated inferior.

gdb/gdbserver/ChangeLog
gdb/gdbserver/inferiors.c

index 5060258080c8ba5a9f81399ca211efe5615a8284..f4a5ca7b46ff1b85ff5b3647031aee49d0d7afcf 100644 (file)
@@ -1,3 +1,8 @@
+2009-03-22  Pedro Alves  <pedro@codesourcery.com>
+
+       * inferiors.c (find_inferior): Make it safe for the callback
+       function to delete the currently iterated inferior.
+
 2009-03-22  Pedro Alves  <pedro@codesourcery.com>
 
        * Makefile.in (linuw_low_h): Move higher.
index bebec9a22b8688eba529dc81f02012a1058b84c9..8ad64fa8de77cc8d9198cca8a9eb815615b06e4e 100644 (file)
@@ -180,9 +180,12 @@ find_inferior (struct inferior_list *list,
 
   while (inf != NULL)
     {
+      struct inferior_list_entry *next;
+
+      next = inf->next;
       if ((*func) (inf, arg))
        return inf;
-      inf = inf->next;
+      inf = next;
     }
 
   return NULL;