Просмотр исходного кода

Correct malloc of checkpoint iteration size from 500 bytes to max section id
size bytes for the created checkpoint


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1145 fd59a12c-fef9-0310-b244-a6a79926bd2f

Steven Dake 19 лет назад
Родитель
Сommit
19ad21f536
3 измененных файлов с 8 добавлено и 5 удалено
  1. 2 0
      exec/ckpt.c
  2. 1 0
      include/ipc_ckpt.h
  3. 5 5
      lib/ckpt.c

+ 2 - 0
exec/ckpt.c

@@ -4088,6 +4088,8 @@ error_exit:
 	res_lib_ckpt_sectioniterationinitialize.header.id = MESSAGE_RES_CKPT_SECTIONITERATIONINITIALIZE;
 	res_lib_ckpt_sectioniterationinitialize.header.error = error;
 	res_lib_ckpt_sectioniterationinitialize.iteration_handle = iteration_handle;
+	res_lib_ckpt_sectioniterationinitialize.max_section_id_size =
+		checkpoint->checkpoint_creation_attributes.max_section_id_size;
 
 	openais_conn_send_response (
 		conn,

+ 1 - 0
include/ipc_ckpt.h

@@ -205,6 +205,7 @@ struct req_lib_ckpt_sectioniterationinitialize {
 struct res_lib_ckpt_sectioniterationinitialize {
 	mar_res_header_t header __attribute__((aligned(8)));
 	unsigned int iteration_handle __attribute__((aligned(8)));
+	mar_size_t max_section_id_size;
 } __attribute__((aligned(8)));
 
 struct req_lib_ckpt_sectioniterationfinalize {

+ 5 - 5
lib/ckpt.c

@@ -91,6 +91,7 @@ struct ckptSectionIterationInstance {
 	int response_fd;
 	SaCkptSectionIterationHandleT sectionIterationHandle;
 	SaNameT checkpointName;
+        SaSizeT maxSectionIdSize;
 	struct list_head sectionIdListHead;
 	pthread_mutex_t response_mutex;
 	unsigned int executive_iteration_handle;
@@ -483,7 +484,6 @@ saCkptDispatch (
 				res_lib_ckpt_checkpointsynchronizeasync->header.error);
 			break;
 		default:
-			/* TODO */
 			break;
 		}
 		/*
@@ -1316,6 +1316,8 @@ saCkptSectionIterationInitialize (
 
 	ckptSectionIterationInstance->executive_iteration_handle =
 		res_lib_ckpt_sectioniterationinitialize.iteration_handle;
+	ckptSectionIterationInstance->maxSectionIdSize =
+		res_lib_ckpt_sectioniterationinitialize.max_section_id_size;
 
 	saHandleInstancePut (&ckptSectionIterationHandleDatabase, *sectionIterationHandle);
 	saHandleInstancePut (&checkpointHandleDatabase, checkpointHandle);
@@ -1354,10 +1356,8 @@ saCkptSectionIterationNext (
 	/*
 	 * Allocate section id storage area
 	 */
-	/*
-	 *  TODO max section id size is 500
-	 */
-	iteratorSectionIdListEntry = malloc (sizeof (struct list_head) + 500);
+	iteratorSectionIdListEntry = malloc (sizeof (struct list_head) +
+		ckptSectionIterationInstance->maxSectionIdSize);
 	if (iteratorSectionIdListEntry == 0) {
 		error = SA_AIS_ERR_NO_MEMORY;
 		goto error_put_nounlock;