Remove module from hash when it's gone

Module was never being removed from hash table. Therefore, if we create
a module, unref it and create it again we will access freed memory.
Commit "53385cf Improve test of double references" introduced a new test
in test-mod-double-ref.c that previously to this commit was crashing and
now it's working fine.
This commit is contained in:
Lucas De Marchi 2011-12-15 13:43:22 -02:00
parent 22907a188c
commit 4084c176c1

View File

@ -392,6 +392,7 @@ KMOD_EXPORT struct kmod_module *kmod_module_unref(struct kmod_module *mod)
DBG(mod->ctx, "kmod_module %p released\n", mod);
kmod_pool_del_module(mod->ctx, mod, mod->hashkey);
kmod_module_unref_list(mod->dep);
kmod_unref(mod->ctx);
free(mod->options);