]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
devlink: Call dl_free in early exit case
authorLeon Romanovsky <leonro@mellanox.com>
Tue, 14 Feb 2017 05:29:38 +0000 (07:29 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Sun, 19 Feb 2017 00:29:56 +0000 (16:29 -0800)
Prior to parsing command options, the devlink tool allocates memory
to store results. In case of early exit (wrong parameters or version
check), this memory wasn't freed.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
devlink/devlink.c

index 23db9e7cd24fbc588e38258e6c138217126e47e3..34a409f7e6605f39d51af1ebf13e1dfd5a87d497 100644 (file)
@@ -2579,7 +2579,8 @@ int main(int argc, char **argv)
                switch (opt) {
                case 'V':
                        printf("devlink utility, iproute2-ss%s\n", SNAPSHOT);
-                       return EXIT_SUCCESS;
+                       ret = EXIT_SUCCESS;
+                       goto dl_free;
                case 'n':
                        dl->no_nice_names = true;
                        break;
@@ -2592,7 +2593,8 @@ int main(int argc, char **argv)
                default:
                        pr_err("Unknown option.\n");
                        help();
-                       return EXIT_FAILURE;
+                       ret = EXIT_FAILURE;
+                       goto dl_free;
                }
        }