From 6b5b470aea3d2b6a76fb4b8fcd72dac82a9f6a56 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Mon, 10 Jul 2006 19:06:01 +0000 Subject: [PATCH] Don't try to reuse the linker_file structure after we've freed it when throwing out the kld's loaded by the loader that didn't successfully link. Found by: Coverity Prevent(tm) CID: 1435 --- sys/kern/kern_linker.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c index 518280357b41..0aeb21c977f2 100644 --- a/sys/kern/kern_linker.c +++ b/sys/kern/kern_linker.c @@ -1409,10 +1409,10 @@ restart: /* * At this point, we check to see what could not be resolved.. */ - TAILQ_FOREACH(lf, &loaded_files, loaded) { + while ((lf = TAILQ_FIRST(&loaded_files)) != NULL) { + TAILQ_REMOVE(&loaded_files, lf, loaded); printf("KLD file %s is missing dependencies\n", lf->filename); linker_file_unload(lf, LINKER_UNLOAD_FORCE); - TAILQ_REMOVE(&loaded_files, lf, loaded); } /*