kmodloader: use the name of the module struct when unloading modules
[project/ubox.git] / kmodloader.c
index dee4b7c69eb4236402d31f821a55b3f0f98ec541..417d1210f0cf77f8d7b2d0c2477308540df62aeb 100644 (file)
@@ -553,13 +553,13 @@ static int main_rmmod(int argc, char **argv)
                LOG("module is not loaded\n");
                return -1;
        }
-       free_modules();
-
-       ret = syscall(__NR_delete_module, name, 0);
+       ret = syscall(__NR_delete_module, m->name, 0);
 
        if (ret)
                LOG("unloading the module failed\n");
 
+       free_modules();
+
        return ret;
 }