From 7e46a5a3379355d40a39eef025025d0f5e5016b8 Mon Sep 17 00:00:00 2001 From: Peter Lieven Date: Mon, 28 Jan 2013 09:31:13 +0100 Subject: [PATCH 1/2] RECONNECT fix lost allocation on reconnect. Signed-off-by: Peter Lieven --- lib/connect.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/connect.c b/lib/connect.c index da3b5d8..86a60f8 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -340,6 +340,10 @@ try_again: iscsi_free_iscsi_inqueue(old_iscsi, old_iscsi->inqueue); } + if (old_iscsi->outqueue_current != NULL && old_iscsi->outqueue_current->flags & ISCSI_PDU_DELETE_WHEN_SENT) { + iscsi_free_pdu(old_iscsi, old_iscsi->outqueue_current); + } + close(iscsi->fd); iscsi->fd = old_iscsi->fd; iscsi->mallocs+=old_iscsi->mallocs; From 8bc0046f5165a884bd26d3f17a92d3da284cd200 Mon Sep 17 00:00:00 2001 From: Peter Lieven Date: Mon, 28 Jan 2013 09:36:00 +0100 Subject: [PATCH 2/2] changed iscsi_data.size from int to size_t iscsi_data.size is used as parameter to memory operation functions (such as malloc) which except size_t rather than int. Signed-off-by: Peter Lieven --- include/iscsi.h | 2 +- lib/socket.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/iscsi.h b/include/iscsi.h index 2c2c720..26b1d24 100644 --- a/include/iscsi.h +++ b/include/iscsi.h @@ -573,7 +573,7 @@ iscsi_task_mgmt_target_cold_reset_async(struct iscsi_context *iscsi, */ struct iscsi_data { - int size; + size_t size; unsigned char *data; }; diff --git a/lib/socket.c b/lib/socket.c index c30f862..54d6234 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -753,8 +753,8 @@ iscsi_queue_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu) unsigned long crc; if (pdu->outdata.size < ISCSI_RAW_HEADER_SIZE + 4) { - iscsi_set_error(iscsi, "PDU too small (%d) to contain header digest", - pdu->outdata.size); + iscsi_set_error(iscsi, "PDU too small (%u) to contain header digest", + (unsigned int) pdu->outdata.size); return -1; }