naccyde / rpms / iproute

Forked from rpms/iproute 9 months ago
Clone

Blame SOURCES/0175-devlink-Call-dl_free-in-early-exit-case.patch

4aca6e
From af98686199a4b31c19894448d3942687bbcd1905 Mon Sep 17 00:00:00 2001
4aca6e
From: Sabrina Dubroca <sdubroca@redhat.com>
4aca6e
Date: Fri, 9 Jun 2017 10:31:30 +0200
4aca6e
Subject: [PATCH] devlink: Call dl_free in early exit case
4aca6e
4aca6e
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1459772
4aca6e
Upstream Status: iproute2.git commit b77c77d29495
4aca6e
4aca6e
commit b77c77d294959bc8c8ef948fc7849d1794347f8e
4aca6e
Author: Leon Romanovsky <leonro@mellanox.com>
4aca6e
Date:   Tue Feb 14 07:29:38 2017 +0200
4aca6e
4aca6e
    devlink: Call dl_free in early exit case
4aca6e
4aca6e
    Prior to parsing command options, the devlink tool allocates memory
4aca6e
    to store results. In case of early exit (wrong parameters or version
4aca6e
    check), this memory wasn't freed.
4aca6e
4aca6e
    Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
4aca6e
    Acked-by: Jiri Pirko <jiri@mellanox.com>
4aca6e
4aca6e
Signed-off-by: Sabrina Dubroca <sdubroca@redhat.com>
4aca6e
---
4aca6e
 devlink/devlink.c | 6 ++++--
4aca6e
 1 file changed, 4 insertions(+), 2 deletions(-)
4aca6e
4aca6e
diff --git a/devlink/devlink.c b/devlink/devlink.c
4aca6e
index ce4aff871595..a81668b0929c 100644
4aca6e
--- a/devlink/devlink.c
4aca6e
+++ b/devlink/devlink.c
4aca6e
@@ -2314,14 +2314,16 @@ int main(int argc, char **argv)
4aca6e
 		switch (opt) {
4aca6e
 		case 'V':
4aca6e
 			printf("devlink utility, iproute2-ss%s\n", SNAPSHOT);
4aca6e
-			return EXIT_SUCCESS;
4aca6e
+			ret = EXIT_SUCCESS;
4aca6e
+			goto dl_free;
4aca6e
 		case 'n':
4aca6e
 			dl->no_nice_names = true;
4aca6e
 			break;
4aca6e
 		default:
4aca6e
 			pr_err("Unknown option.\n");
4aca6e
 			help();
4aca6e
-			return EXIT_FAILURE;
4aca6e
+			ret = EXIT_FAILURE;
4aca6e
+			goto dl_free;
4aca6e
 		}
4aca6e
 	}
4aca6e
 
4aca6e
-- 
4aca6e
2.13.1
4aca6e