From 5a16f075f5471e1f4bc41872f299c390dd46f727 Mon Sep 17 00:00:00 2001 From: Michael Pronath Date: Fri, 1 Dec 2000 17:30:42 +0000 Subject: [PATCH] linux-module-initialization-allocate-20001201 Loading and unloading a module without starting AFS would oops without this because nothing checked for allocation. --- src/afs/LINUX/osi_alloc.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/afs/LINUX/osi_alloc.c b/src/afs/LINUX/osi_alloc.c index ab0352d63..75d7498f1 100644 --- a/src/afs/LINUX/osi_alloc.c +++ b/src/afs/LINUX/osi_alloc.c @@ -339,20 +339,21 @@ void osi_linux_free_afs_memory(void) { down(&afs_linux_alloc_sem); - /* iterate through all elements in the hash table and free both - * the chunk and the atom associated with it. - */ - afs_lhash_iter(lh_mem_htab, hash_free); - - /* free the atomlist. */ - afs_atomlist_destroy(al_mem_pool); - - /* free the hashlist. */ - afs_lhash_destroy(lh_mem_htab); - - /* change the state so that the allocator is now uninitialized. */ - allocator_init = 0; - + if (allocator_init) { + /* iterate through all elements in the hash table and free both + * the chunk and the atom associated with it. + */ + afs_lhash_iter(lh_mem_htab, hash_free); + + /* free the atomlist. */ + afs_atomlist_destroy(al_mem_pool); + + /* free the hashlist. */ + afs_lhash_destroy(lh_mem_htab); + + /* change the state so that the allocator is now uninitialized. */ + allocator_init = 0; + } up(&afs_linux_alloc_sem); } -- 2.39.5