From 46c6c4f47cc1f5a9146db61a24b35f5fe611f842 Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Tue, 29 Mar 2005 22:43:15 +0000 Subject: [PATCH] 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 --- exec/ckpt.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/exec/ckpt.c b/exec/ckpt.c index dfa9a09c..567ed718 100644 --- a/exec/ckpt.c +++ b/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,