Don't dereference invalid pointers in procfs_mourn_inferior
authorThomas Lord <lord@cygnus>
Fri, 5 Aug 1994 17:55:46 +0000 (17:55 +0000)
committerThomas Lord <lord@cygnus>
Fri, 5 Aug 1994 17:55:46 +0000 (17:55 +0000)
gdb/ChangeLog
gdb/procfs.c

index da4a79bd9fccc5afb974a3b476eadc52f1a7668d..36505f371326cef4c215f0306d444aa363c2a4f6 100644 (file)
@@ -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
index e1cbf803181def8fad5eda79b788e6ffab4cf217..637837fab4f569e6156cce89dccd1038659a385a 100644 (file)
@@ -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 ()