dc245c
From 5a94d5d73a18369e6f7b7c54674dc20b9c7d0a8e Mon Sep 17 00:00:00 2001
dc245c
From: Peter Lieven <pl@kamp.de>
dc245c
Date: Mon, 11 Mar 2013 08:51:18 +0100
dc245c
Subject: [RHEL7 libiscsi PATCH 02/18] fix leak of iscsi_context in iscsi_reconnect
dc245c
dc245c
in case the maximum number of reconnects is limited with
dc245c
iscsi_set_reconnect_max_retries() the an iscsi_context
dc245c
is leaked if the limit is exhausted.
dc245c
dc245c
Signed-off-by: Peter Lieven <pl@kamp.de>
dc245c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
dc245c
(cherry-picked from upstream commit 5a94d5d73a18369e6f7b7c54674dc20b9c7d0a8e)
dc245c
---
dc245c
 lib/connect.c | 1 +
dc245c
 1 file changed, 1 insertion(+)
dc245c
dc245c
diff --git a/lib/connect.c b/lib/connect.c
dc245c
index d3fa9d1..7429496 100644
dc245c
--- a/lib/connect.c
dc245c
+++ b/lib/connect.c
dc245c
@@ -277,6 +277,7 @@ try_again:
dc245c
 	if (iscsi_full_connect_sync(iscsi, iscsi->portal, iscsi->lun) != 0) {
dc245c
 		if (iscsi->reconnect_max_retries != -1 && retry >= iscsi->reconnect_max_retries) {
dc245c
 			iscsi_defer_reconnect(old_iscsi);
dc245c
+			iscsi_destroy_context(iscsi);
dc245c
 			return -1;
dc245c
 		}
dc245c
 		int backoff=retry;
dc245c
-- 
dc245c
1.8.1.4
dc245c