From 4139fc0c07d42fae6d3f489c2845de12d147b4ce Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 6 Feb 2001 12:27:57 +0000 Subject: [PATCH] [project @ 2001-02-06 12:27:57 by simonmar] oops, forgot to remove the object from the linked list when we unload it. --- ghc/rts/Linker.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ghc/rts/Linker.c b/ghc/rts/Linker.c index 90b0ab1..8b42806 100644 --- a/ghc/rts/Linker.c +++ b/ghc/rts/Linker.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: Linker.c,v 1.16 2001/02/01 12:37:44 simonmar Exp $ + * $Id: Linker.c,v 1.17 2001/02/06 12:27:57 simonmar Exp $ * * (c) The GHC Team, 2000 * @@ -463,9 +463,10 @@ resolveObjs( void ) HsInt unloadObj( char *path ) { - ObjectCode *oc; + ObjectCode *oc, *prev; - for (oc = objects; oc; oc = oc->next) { + prev = NULL; + for (oc = objects; oc; prev = oc, oc = oc->next) { if (!strcmp(oc->fileName,path)) { /* Remove all the mappings for the symbols within this @@ -480,6 +481,12 @@ unloadObj( char *path ) } } + if (prev == NULL) { + objects = oc->next; + } else { + prev->next = oc->next; + } + /* We're going to leave this in place, in case there are any pointers from the heap into it: */ /* free(oc->image); */ @@ -489,7 +496,7 @@ unloadObj( char *path ) return 1; } } - + belch("unloadObj: can't find `%s' to unload", path); return 0; } -- 1.7.10.4