From 9d27cc2f350ec72e94bb03b71f7ce8fcd0bccbbe Mon Sep 17 00:00:00 2001 From: Steven Dake Date: Tue, 7 Aug 2007 23:52:21 +0000 Subject: [PATCH] Fix minor leaks caused by not calling pthread_mutex_destroy throughout the tree. git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1412 fd59a12c-fef9-0310-b244-a6a79926bd2f --- exec/ipc.c | 3 ++- lib/amf.c | 4 ++++ lib/cfg.c | 4 ++++ lib/ckpt.c | 11 ++++++++++- lib/clm.c | 4 ++++ lib/cpg.c | 4 ++++ lib/evs.c | 4 ++++ lib/evt.c | 6 ++++++ lib/lck.c | 5 ++++- lib/msg.c | 5 ++++- 10 files changed, 46 insertions(+), 4 deletions(-) diff --git a/exec/ipc.c b/exec/ipc.c index 693a3ba0..cca08ddc 100644 --- a/exec/ipc.c +++ b/exec/ipc.c @@ -375,7 +375,8 @@ static void conn_info_destroy (struct conn_info *conn_info) pthread_attr_destroy (&conn_info->thread_attr); pthread_mutex_destroy (&conn_info->mutex); - + pthread_mutex_destroy (&conn_info->flow_control_mutex); + list_del (&conn_info->list); free (conn_info); } diff --git a/lib/amf.c b/lib/amf.c index cf77ccf9..8d819871 100644 --- a/lib/amf.c +++ b/lib/amf.c @@ -101,6 +101,10 @@ static struct saVersionDatabase amfVersionDatabase = { void amfHandleInstanceDestructor (void *instance) { + struct amfInstance *amfInstance = instance; + + pthread_mutex_destroy (&amfInstance->response_mutex); + pthread_mutex_destroy (&amfInstance->dispatch_mutex); } SaAisErrorT diff --git a/lib/cfg.c b/lib/cfg.c index a8f399a8..236b3b95 100644 --- a/lib/cfg.c +++ b/lib/cfg.c @@ -89,6 +89,10 @@ static struct saHandleDatabase cfg_hdb = { */ void cfg_handleInstanceDestructor (void *instance) { + struct cfg_instance *cfg_instance = instance; + + pthread_mutex_destroy (&cfg_instance->response_mutex); + pthread_mutex_destroy (&cfg_instance->dispatch_mutex); } SaAisErrorT diff --git a/lib/ckpt.c b/lib/ckpt.c index 70c6dee6..f3b25679 100644 --- a/lib/ckpt.c +++ b/lib/ckpt.c @@ -155,15 +155,24 @@ struct iteratorSectionIdListEntry { */ void ckptHandleInstanceDestructor (void *instance) { + struct ckptInstance *ckptInstance = instance; + + pthread_mutex_destroy (&ckptInstance->response_mutex); + pthread_mutex_destroy (&ckptInstance->dispatch_mutex); } void checkpointHandleInstanceDestructor (void *instance) { - return; + struct ckptCheckpointInstance *checkpointInstance = instance; + + pthread_mutex_destroy (&checkpointInstance->response_mutex); } void ckptSectionIterationHandleInstanceDestructor (void *instance) { + struct ckptSectionIterationInstance *iterationInstance = instance; + + pthread_mutex_destroy (&iterationInstance->response_mutex); } static void ckptSectionIterationInstanceFinalize (struct ckptSectionIterationInstance *ckptSectionIterationInstance) diff --git a/lib/clm.c b/lib/clm.c index a0eef555..a965c8e9 100644 --- a/lib/clm.c +++ b/lib/clm.c @@ -93,6 +93,10 @@ static struct saVersionDatabase clmVersionDatabase = { void clmHandleInstanceDestructor (void *instance) { + struct clmInstance *clmInstance = instance; + + pthread_mutex_destroy (&clmInstance->response_mutex); + pthread_mutex_destroy (&clmInstance->dispatch_mutex); } diff --git a/lib/cpg.c b/lib/cpg.c index fecc8647..e06d3253 100644 --- a/lib/cpg.c +++ b/lib/cpg.c @@ -76,6 +76,10 @@ static struct saHandleDatabase cpg_handle_t_db = { */ static void cpg_instance_destructor (void *instance) { + struct cpg_inst *cpg_inst = instance; + + pthread_mutex_destroy (&cpg_inst->response_mutex); + pthread_mutex_destroy (&cpg_inst->dispatch_mutex); } diff --git a/lib/evs.c b/lib/evs.c index 9de981a0..96aaef18 100644 --- a/lib/evs.c +++ b/lib/evs.c @@ -81,6 +81,10 @@ static struct saHandleDatabase evs_handle_t_db = { */ static void evs_instance_destructor (void *instance) { + struct evs_inst *evs_inst = instance; + + pthread_mutex_destroy (&evs_inst->response_mutex); + pthread_mutex_destroy (&evs_inst->dispatch_mutex); } diff --git a/lib/evt.c b/lib/evt.c index f98eb093..7c289d29 100644 --- a/lib/evt.c +++ b/lib/evt.c @@ -244,6 +244,9 @@ static void evtHandleInstanceDestructor(void *instance) saHandleDestroy(&channel_handle_db, handle); saHandleInstancePut(&channel_handle_db, handle); } + + pthread_mutex_destroy(&evti->ei_dispatch_mutex); + pthread_mutex_destroy(&evti->ei_response_mutex); } /* @@ -271,6 +274,7 @@ static void chanHandleInstanceDestructor(void *instance) saEvtEventFree(handle); } + pthread_mutex_destroy(&eci->eci_mutex); } /* @@ -295,6 +299,8 @@ static void eventHandleInstanceDestructor(void *instance) if (edi->edi_event_data) { free(edi->edi_event_data); } + + pthread_mutex_destroy(&edi->edi_mutex); } static SaAisErrorT evt_recv_event(int fd, struct lib_event_data **msg) diff --git a/lib/lck.c b/lib/lck.c index 29284f52..8ec5c49d 100644 --- a/lib/lck.c +++ b/lib/lck.c @@ -143,11 +143,14 @@ static struct saVersionDatabase lckVersionDatabase = { */ void lckHandleInstanceDestructor (void *instance) { + struct lckInstance *lckInstance = instance; + + pthread_mutex_destroy (&lckInstance->response_mutex); + pthread_mutex_destroy (&lckInstance->dispatch_mutex); } void lckResourceHandleInstanceDestructor (void *instance) { - return; } void lckResourceHandleLockIdInstanceDestructor (void *instance) diff --git a/lib/msg.c b/lib/msg.c index 8c3f8f7b..3b9571cc 100644 --- a/lib/msg.c +++ b/lib/msg.c @@ -130,11 +130,14 @@ struct iteratorSectionIdListEntry { */ void msgHandleInstanceDestructor (void *instance) { + struct msgInstance *msgInstance = instance; + + pthread_mutex_destroy (&msgInstance->response_mutex); + pthread_mutex_destroy (&msgInstance->dispatch_mutex); } void queueHandleInstanceDestructor (void *instance) { - return; } #ifdef COMPILE_OUT