Fix leak of kmod_module and fix code style
authorLucas De Marchi <lucas.demarchi@profusion.mobi>
Sun, 1 Jan 2012 07:55:25 +0000 (05:55 -0200)
committerLucas De Marchi <lucas.demarchi@profusion.mobi>
Sun, 1 Jan 2012 08:12:59 +0000 (06:12 -0200)
tools/kmod-modprobe.c

index 2a649dd..c985a83 100644 (file)
@@ -509,12 +509,14 @@ done:
        }
 
        deps = kmod_module_get_dependencies(mod);
-       if (deps) {
+       if (deps != NULL) {
                kmod_list_foreach(itr, deps) {
                        struct kmod_module *dep = kmod_module_get_module(itr);
-                       if (kmod_module_get_refcnt(dep) == 0) {
+
+                       if (kmod_module_get_refcnt(dep) == 0)
                                rmmod_do(dep);
-                       }
+
+                       kmod_module_unref(dep);
                }
                kmod_module_unref_list(deps);
        }