Blob Blame History Raw
log failures (typically malloc) of iscsi_create_context during reconnect

Message-id: <1383729402-27559-7-git-send-email-pbonzini@redhat.com>
Patchwork-id: 55501
O-Subject: [PATCH 06/11] log failures (typically malloc) of iscsi_create_context during reconnect
Bugzilla: 1026820
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 1acce4a94892ffc8fb75945fc2d2ee691b66a524)
---
 lib/connect.c | 5 +++++
 1 file changed, 5 insertions(+)
diff --git a/lib/connect.c b/lib/connect.c
index d6a8759..cd3f336 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -245,6 +245,11 @@ int iscsi_reconnect(struct iscsi_context *old_iscsi)
 try_again:
 
 	iscsi = iscsi_create_context(old_iscsi->initiator_name);
+	if (!iscsi) {
+		ISCSI_LOG(old_iscsi, 2, "failed to create new context for reconnection");
+		return -1;
+	}
+
 	iscsi->is_reconnecting = 1;
 
 	iscsi_set_targetname(iscsi, old_iscsi->target_name);