open-iscsi/6014-Resource-leak-Variable-matched_ses-going-out-of-scope.patch
2020-01-09 16:49:50 +08:00

35 lines
881 B
Diff

From 096fc3ca10492c0810f1aaf76266006a2a803109 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 30 Oct 2019 13:54:27 -0700
Subject: [PATCH 31/43] Resource leak: Variable matched_ses going out of scope
leaks the storage it points to.
---
usr/host.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/usr/host.c b/usr/host.c
index 356650c..c94b6d1 100644
--- a/usr/host.c
+++ b/usr/host.c
@@ -262,14 +262,14 @@ static int host_info_print_tree(void *data, struct host_info *hinfo)
matched_ses[matched_se_count++] = ses[i];
if (!matched_se_count)
- return 0;
+ goto out;
printf("\t*********\n");
printf("\tSessions:\n");
printf("\t*********\n");
session_info_print_tree(matched_ses, matched_se_count, "\t",
session_info_flags, 0/* don't show password */);
-
+out:
free(matched_ses);
return 0;
}
--
2.21.0