Found-by: Coverity Scan #1412469
Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
if (init_module_folders()) {
fprintf(stderr, "Failed to find the folder holding the modules\n");
- return -1;
+ ret = -1;
+ goto err;
}
if (get_module_path(argv[1])) {
name = argv[1];
} else if (!get_module_path(name)) {
fprintf(stderr, "Failed to find %s. Maybe it is a built in module ?\n", name);
- return -1;
+ ret = -1;
+ goto err;
}
ret = insert_module(get_module_path(name), options);
- free(options);
-
if (ret)
ULOG_ERR("failed to insert %s\n", get_module_path(name));
+err:
+ free(options);
return ret;
}