From 4084c176c1504397d0f66bd404799f7b2da92058 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Thu, 15 Dec 2011 13:43:22 -0200 Subject: [PATCH] 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. --- libkmod/libkmod-module.c | 1 + 1 file changed, 1 insertion(+) 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 @@ 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);