File 0016-fabrics-Only-free-initialized-valued-on-exit.patch of Package nvme-cli.26915

From: Daniel Wagner <dwagner@suse.de>
Date: Mon, 8 Nov 2021 10:22:17 +0100
Subject: fabrics: Only free initialized valued on exit
References: bsc#1191935
Git-commit: f868aa4cbbed813118acd5ff109e4bb82e1ed49f

ctrl_matches_connectargs() bails out if addr, subsysnqn or transport
are not valid. If this is the case only attempt to free those pointers
as these pointers are properly inialized, e.g. either NULL or a valid.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 fabrics.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/fabrics.c
+++ b/fabrics.c
@@ -351,12 +351,12 @@ static bool ctrl_matches_connectargs(cha
 	     !strcmp(args->host_traddr, "none")))
 		found = true;
 
-out:
-	free(cargs.subsysnqn);
-	free(cargs.transport);
 	free(cargs.traddr);
 	free(cargs.trsvcid);
 	free(cargs.host_traddr);
+out:
+	free(cargs.subsysnqn);
+	free(cargs.transport);
 
 	return found;
 }
openSUSE Build Service is sponsored by