From cd4104e085374f382bdd22c24d5e42b17f25099c Mon Sep 17 00:00:00 2001 From: Thomas Lord Date: Fri, 5 Aug 1994 17:55:46 +0000 Subject: [PATCH] Don't dereference invalid pointers in procfs_mourn_inferior --- gdb/ChangeLog | 6 ++++++ gdb/procfs.c | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index da4a79bd9fc..36505f37132 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -56,6 +56,12 @@ Thu Aug 4 07:55:04 1994 Jim Kingdon (kingdon@lioth.cygnus.com) target_terminal_inferior once the child execs. * infrun.c (proceed): Pass argument to PREPARE_TO_PROCEED. +Wed Aug 3 22:41:13 1994 Tom Lord (lord@x1.cygnus.com) + + * procfs.c(procfs_mourn_inferior): don't dereference the + procinfo pointer after it has been freed. + + Wed Aug 3 12:05:13 1994 Stan Shebs (shebs@andros.cygnus.com) * breakpoint.c (breakpoint_1): Improve pluralization in display diff --git a/gdb/procfs.c b/gdb/procfs.c index e1cbf803181..637837fab4f 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -3540,14 +3540,19 @@ static void procfs_mourn_inferior () { struct procinfo *pi; + struct procinfo *next_pi; - for (pi = procinfo_list; pi; pi = pi->next) - unconditionally_kill_inferior (pi); + for (pi = procinfo_list; pi; pi = next_pi) + { + next_pi = pi->next; + unconditionally_kill_inferior (pi); + } unpush_target (&procfs_ops); generic_mourn_inferior (); } + /* Mark our target-struct as eligible for stray "run" and "attach" commands. */ static int procfs_can_run () -- 2.30.2