ubox: Initialize conditionally uninitialized variabled
[project/ubox.git] / kmodloader.c
index e32e6af..f80835a 100644 (file)
@@ -609,7 +609,10 @@ static int main_insmod(int argc, char **argv)
                cur += sprintf(cur, "%s", argv[i]);
        }
 
-       init_module_folders();
+       if (init_module_folders()) {
+               fprintf(stderr, "Failed to find the folder holding the modules\n");
+               return -1;
+       }
 
        if (get_module_path(argv[1])) {
                name = argv[1];
@@ -772,11 +775,15 @@ static int main_loader(int argc, char **argv)
        strcpy(path, dir);
        strcat(path, "*");
 
-       if (scan_loaded_modules())
+       if (scan_loaded_modules()) {
+               free (path);
                return -1;
+       }
 
-       if (scan_module_folders())
+       if (scan_module_folders()) {
+               free (path);
                return -1;
+       }
 
        syslog(LOG_INFO, "kmodloader: loading kernel modules from %s\n", path);