Procházet zdrojové kódy

Patch from Muni Bajpai to not setup a cleanup handler for a
checkpoint when a checkpoint open fails. Patch also fixes up
checkpoint iterators so they do not crash on process exit.

(Logical change 1.164)


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

Steven Dake před 21 roky
rodič
revize
46c6c4f47c
1 změnil soubory, kde provedl 10 přidání a 16 odebrání
  1. 10 16
      exec/ckpt.c

+ 10 - 16
exec/ckpt.c

@@ -980,18 +980,10 @@ static int ckpt_exit_fn (struct conn_info *conn_info)
 		cleanup_list = conn_info->ais_ci.u.libckpt_ci.checkpoint_list.next;
 	}
 
-#ifdef TODO
-/* TODO close section iterators
- */
-/* 
- * TODO what about exit of open checkpoints
- */
-
 	if (conn_info->ais_ci.u.libckpt_ci.sectionIterator.sectionIteratorEntries) {
 		free (conn_info->ais_ci.u.libckpt_ci.sectionIterator.sectionIteratorEntries);
 	}
 	list_del (&conn_info->ais_ci.u.libckpt_ci.sectionIterator.list);
-#endif
 	return (0);
 }
 
@@ -1125,14 +1117,16 @@ error_exit:
 		res_lib_ckpt_checkpointopen.header.id = MESSAGE_RES_CKPT_CHECKPOINT_CHECKPOINTOPEN;
 		res_lib_ckpt_checkpointopen.header.error = error;
 
-		checkpoint_cleanup = malloc (sizeof (struct checkpoint_cleanup));
-		if (checkpoint_cleanup == 0) {
-			free (ckptCheckpoint);
-			error = SA_AIS_ERR_NO_MEMORY;
-		} else {
-			memcpy(&checkpoint_cleanup->checkpoint,ckptCheckpoint,sizeof(struct saCkptCheckpoint));
-			list_add (&checkpoint_cleanup->list,
-				&req_exec_ckpt_checkpointopen->source.conn_info->ais_ci.u.libckpt_ci.checkpoint_list);
+		if (error == SA_AIS_OK) {
+			checkpoint_cleanup = malloc (sizeof (struct checkpoint_cleanup));
+			if (checkpoint_cleanup == 0) {
+				free (ckptCheckpoint);
+				error = SA_AIS_ERR_NO_MEMORY;
+			} else {
+				memcpy(&checkpoint_cleanup->checkpoint,ckptCheckpoint,sizeof(struct saCkptCheckpoint));
+				list_add (&checkpoint_cleanup->list,
+					&req_exec_ckpt_checkpointopen->source.conn_info->ais_ci.u.libckpt_ci.checkpoint_list);
+			}
 		}
 
 		libais_send_response (req_exec_ckpt_checkpointopen->source.conn_info, &res_lib_ckpt_checkpointopen,