]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
depmod: fix asserting mod->kmod == NULL
authorLucas De Marchi <lucas.demarchi@profusion.mobi>
Fri, 16 Nov 2012 14:05:42 +0000 (12:05 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Fri, 16 Nov 2012 14:05:42 +0000 (12:05 -0200)
If we are replacing a lower priority module (due to its location), we
already created a kmod_module, but didn't open the file for reading its
symbols. This means mod->kmod won't be NULL, and this is just ok. Since
all the functions freeing stuff below the previous assert already takes
NULL into consideration, it's safe to just unref mod->kmod and let the
right thing happens.

tools/depmod.c

index aafe66b113040f975982a4fd72a61602c5eefdbd..7bbdcd353e6319250a36ca6153770aabfb676950 100644 (file)
@@ -977,7 +977,7 @@ static void mod_free(struct mod *mod)
 {
        DBG("free %p kmod=%p, path=%s\n", mod, mod->kmod, mod->path);
        array_free_array(&mod->deps);
-       assert(mod->kmod == NULL);
+       kmod_module_unref(mod->kmod);
        kmod_module_info_free_list(mod->info_list);
        kmod_module_dependency_symbols_free_list(mod->dep_sym_list);
        free(mod->uncrelpath);