diff options
author | Edward Z. Yang <ezyang@cs.stanford.edu> | 2014-04-12 23:02:13 -0700 |
---|---|---|
committer | Edward Z. Yang <ezyang@cs.stanford.edu> | 2014-04-12 23:36:45 -0700 |
commit | e3938f3adac0093b23694fd347774244ce121478 (patch) | |
tree | 9997d4183c08da311094cfc59286513b50cabf22 /rts | |
parent | 7233638ba6e82179cc4bd1b981eff5292b18e118 (diff) | |
download | haskell-e3938f3adac0093b23694fd347774244ce121478.tar.gz |
Fix linked list manipulation code (buggy on consecutive deletion)
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Diffstat (limited to 'rts')
-rw-r--r-- | rts/CheckUnload.c | 3 | ||||
-rw-r--r-- | rts/Linker.c | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/rts/CheckUnload.c b/rts/CheckUnload.c index f1f454ceaf..98f184b84c 100644 --- a/rts/CheckUnload.c +++ b/rts/CheckUnload.c @@ -298,7 +298,7 @@ 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 = next) { + for (oc = unloaded_objects; oc; oc = next) { next = oc->next; if (oc->referenced == 0) { if (prev == NULL) { @@ -312,6 +312,7 @@ void checkUnload (StgClosure *static_objects) } else { IF_DEBUG(linker, debugBelch("Object file still in use: %" PATH_FMT "\n", oc->fileName)); + prev = oc; } } diff --git a/rts/Linker.c b/rts/Linker.c index af26d74a57..ab235e9f5c 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -3016,8 +3016,8 @@ unloadObj( pathchar *path ) IF_DEBUG(linker, debugBelch("unloadObj: %" PATH_FMT "\n", path)); prev = NULL; - for (oc = objects; oc; prev = oc, oc = next) { - next = oc->next; + for (oc = objects; oc; oc = next) { + next = oc->next; // oc might be freed if (!pathcmp(oc->fileName,path)) { @@ -3075,6 +3075,8 @@ unloadObj( pathchar *path ) /* This could be a member of an archive so continue * unloading other members. */ unloadedAnyObj = HS_BOOL_TRUE; + } else { + prev = oc; } } |