From 2b0711e51ea5d107074b8a74c9ddc8c1a4a1deaa Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Wed, 13 Jul 2005 20:03:15 +0000 Subject: [PATCH] defect 681 if null paramter passed to checkpoint service as iovector element, allocate the io vector element git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@736 fd59a12c-fef9-0310-b244-a6a79926bd2f --- lib/ckpt.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/ckpt.c b/lib/ckpt.c index b6cad958..5b75a026 100644 --- a/lib/ckpt.c +++ b/lib/ckpt.c @@ -1523,6 +1523,15 @@ saCkptCheckpointRead ( /* * Receive checkpoint section data */ + if (ioVector[i].dataBuffer == 0) { + ioVector[i].dataBuffer = + malloc (dataLength); + if (ioVector[i].dataBuffer == NULL) { + error = SA_AIS_ERR_NO_MEMORY; + goto error_exit; + } + } + if (dataLength > 0) { error = saRecvRetry (ckptCheckpointInstance->response_fd, ioVector[i].dataBuffer, dataLength, MSG_WAITALL | MSG_NOSIGNAL); @@ -1531,9 +1540,6 @@ saCkptCheckpointRead ( } } if (res_lib_ckpt_sectionread.header.error != SA_AIS_OK) { - if (erroneousVectorIndex) { - *erroneousVectorIndex = i; - } goto error_exit; } @@ -1548,6 +1554,9 @@ error_exit: saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle); + if (error != SA_AIS_OK && erroneousVectorIndex) { + *erroneousVectorIndex = i; + } return (error == SA_AIS_OK ? res_lib_ckpt_sectionread.header.error : error); }