[commit: ghc] master: Don't refer to oc->next after freeing oc. (1fb558d)

git at git.haskell.org git at git.haskell.org
Wed Sep 4 12:37:52 CEST 2013


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/1fb558d13d702246fe45b11d78011f32910d90b7/ghc

>---------------------------------------------------------------

commit 1fb558d13d702246fe45b11d78011f32910d90b7
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Wed Sep 4 11:08:10 2013 +0100

    Don't refer to oc->next after freeing oc.


>---------------------------------------------------------------

1fb558d13d702246fe45b11d78011f32910d90b7
 rts/CheckUnload.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/rts/CheckUnload.c b/rts/CheckUnload.c
index 0485ed4..d3fb893 100644
--- a/rts/CheckUnload.c
+++ b/rts/CheckUnload.c
@@ -246,7 +246,7 @@ void checkUnload (StgClosure *static_objects)
   HashTable *addrs;
   StgClosure* p;
   const StgInfoTable *info;
-  ObjectCode *oc, *prev;
+  ObjectCode *oc, *prev, *next;
   gen_workspace *ws;
   StgClosure* link;
 
@@ -283,7 +283,8 @@ void checkUnload (StgClosure *static_objects)
   // marked as unreferenced can be physically unloaded, because we
   // have no references to it.
   prev = NULL;
-  for (oc = unloaded_objects; oc; prev = oc, oc = oc->next) {
+  for (oc = unloaded_objects; oc; prev = oc, oc = next) {
+      next = oc->next;
       if (oc->referenced == 0) {
           if (prev == NULL) {
               unloaded_objects = oc->next;





More information about the ghc-commits mailing list