From: Pedro Alves Date: Sun, 22 Mar 2009 22:34:04 +0000 (+0000) Subject: * inferiors.c (find_inferior): Make it safe for the callback X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a07b2135dbda574558da179559ccc1cd335f896e;p=binutils-gdb.git * inferiors.c (find_inferior): Make it safe for the callback function to delete the currently iterated inferior. --- diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 5060258080c..f4a5ca7b46f 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,8 @@ +2009-03-22 Pedro Alves + + * inferiors.c (find_inferior): Make it safe for the callback + function to delete the currently iterated inferior. + 2009-03-22 Pedro Alves * Makefile.in (linuw_low_h): Move higher. diff --git a/gdb/gdbserver/inferiors.c b/gdb/gdbserver/inferiors.c index bebec9a22b8..8ad64fa8de7 100644 --- a/gdb/gdbserver/inferiors.c +++ b/gdb/gdbserver/inferiors.c @@ -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;