From: Alexander Couzens Date: Sun, 11 Jun 2017 10:20:59 +0000 (+0200) Subject: kmodloader: insmod: fix a memoryleak in error case X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a0b6feff3b0e8ef56470f20e30f93d012dffc290;p=oweals%2Fubox.git kmodloader: insmod: fix a memoryleak in error case Found-by: Coverity Scan #1412469 Signed-off-by: Alexander Couzens --- diff --git a/kmodloader.c b/kmodloader.c index 9aba523..3b7ec8b 100644 --- a/kmodloader.c +++ b/kmodloader.c @@ -691,22 +691,24 @@ static int main_insmod(int argc, char **argv) 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; }