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.
diff --git a/libkmod/libkmod-module.c b/libkmod/libkmod-module.c
index 79a49c3..6b6911b 100644
--- a/libkmod/libkmod-module.c
+++ b/libkmod/libkmod-module.c
@@ -392,6 +392,7 @@
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);