From a07b2135dbda574558da179559ccc1cd335f896e Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Sun, 22 Mar 2009 22:34:04 +0000 Subject: [PATCH] * inferiors.c (find_inferior): Make it safe for the callback function to delete the currently iterated inferior. --- gdb/gdbserver/ChangeLog | 5 +++++ gdb/gdbserver/inferiors.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) 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; -- 2.30.2