From 795cb4c46d301a334c2aa7a98972a98d10828208 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Tue, 28 May 2002 18:42:32 +0000 Subject: [PATCH] fixed ellFree cause malloc and free to be in different win32 dlls --- src/ca/access.c | 15 +++++++++------ src/ca/iocinf.c | 29 +++++++++++++++++++++++++++- src/ca/iocinf.h | 4 ++++ src/ca/syncgrp.c | 5 ++++- src/ca/vxWorks_depen.c | 7 +++++-- src/cas/io/bsdSocket/casDGIntfIO.cc | 30 +++++++++++++++++++++++++++-- 6 files changed, 78 insertions(+), 12 deletions(-) diff --git a/src/ca/access.c b/src/ca/access.c index 82d9e67c9..420183dc8 100644 --- a/src/ca/access.c +++ b/src/ca/access.c @@ -99,6 +99,9 @@ /************************************************************************/ /* * $Log$ + * Revision 1.107.2.9 2002/03/14 01:13:57 jhill + * fixed put notify shutdown during channel delete + * * Revision 1.107.2.8 2002/03/08 00:25:08 jhill * fixed bug where the db_put_field in the local event callback stub was supplied * with a destination that was the database field. In situations where the dbAccess @@ -967,7 +970,7 @@ void ca_process_exit() /* * free address list */ - ellFree(&piiu->destAddr); + ellFreeCA(&piiu->destAddr); piiu = (struct ioc_in_use *) piiu->node.next; } @@ -979,10 +982,10 @@ void ca_process_exit() caIOBlockListFree (&ca_static->ca_pend_write_list, NULL, FALSE, ECA_INTERNAL); /* remove any pending io event blocks */ - ellFree(&ca_static->ca_ioeventlist); + ellFreeCA(&ca_static->ca_ioeventlist); /* remove put convert block free list */ - ellFree(&ca_static->putCvrtBuf); + ellFreeCA(&ca_static->putCvrtBuf); /* reclaim sync group resources */ ca_sg_shutdown(ca_static); @@ -991,13 +994,13 @@ void ca_process_exit() freeListCleanup(ca_static->ca_ioBlockFreeListPVT); /* free select context lists */ - ellFree(&ca_static->fdInfoFreeList); - ellFree(&ca_static->fdInfoList); + ellFreeCA(&ca_static->fdInfoFreeList); + ellFreeCA(&ca_static->fdInfoList); /* * remove IOCs in use */ - ellFree(&ca_static->ca_iiuList); + ellFreeCA(&ca_static->ca_iiuList); /* * free user name string diff --git a/src/ca/iocinf.c b/src/ca/iocinf.c index e09b943d1..b310a05b9 100644 --- a/src/ca/iocinf.c +++ b/src/ca/iocinf.c @@ -48,6 +48,9 @@ /* kernels that support multicast */ /* * $Log$ + * Revision 1.84.4.3 2002/02/07 18:49:16 jhill + * workaround for CONNRESET error from disconnected socket on windows + * * Revision 1.84.4.2 2001/03/06 00:32:45 jhill * fixed R3.13 for Linux's new socklen_t * @@ -1495,7 +1498,7 @@ void cac_close_ioc (IIU *piiu) piiu->sock_chan = INVALID_SOCKET; - ellFree (&piiu->destAddr); + ellFreeCA (&piiu->destAddr); if (chanDisconnectCount) { genLocalExcep (ECA_DISCONN, piiu->host_name_str); @@ -2158,3 +2161,27 @@ int caSendMsgPending() return pending; } +/**************************************************************************** + * + * The rumor is that windows croaks if the malloc and free are not in the + * same dll. + * + *****************************************************************************/ +void ellFreeCA (ELLLIST *pList) +{ + ELLNODE *nnode = pList->node.next; + ELLNODE *pnode; + + while (nnode != NULL) + { + pnode = nnode; + nnode = nnode->next; + free(pnode); + } + pList->node.next = NULL; + pList->node.previous = NULL; + pList->count = 0; + + return; +} + diff --git a/src/ca/iocinf.h b/src/ca/iocinf.h index 6b147dab7..e53086411 100644 --- a/src/ca/iocinf.h +++ b/src/ca/iocinf.h @@ -33,6 +33,9 @@ /* * $Log$ + * Revision 1.74.4.4 2002/03/14 01:13:57 jhill + * fixed put notify shutdown during channel delete + * * Revision 1.74.4.3 2000/11/30 22:07:51 jhill * changes from Ken Evans * @@ -777,6 +780,7 @@ void cac_create_udp_fd(void); double cac_fetch_poll_period(void); int caSockAddrFromHost(const char *pName, struct sockaddr *paddr); void cac_close_ioc (IIU *piiu); +void ellFreeCA (ELLLIST *pList); /* * !!KLUDGE!! diff --git a/src/ca/syncgrp.c b/src/ca/syncgrp.c index dba05137b..2e33fbf02 100644 --- a/src/ca/syncgrp.c +++ b/src/ca/syncgrp.c @@ -29,6 +29,9 @@ * Modification Log: * ----------------- * $Log$ + * Revision 1.26.6.1 1999/07/15 21:02:25 jhill + * fixed bug where client disconnects while waiting to send TCP + * * Revision 1.26 1997/08/04 23:37:18 jhill * added beacon anomaly flag init/allow ip 255.255.255.255 * @@ -117,7 +120,7 @@ void ca_sg_shutdown(struct CA_STATIC *ca_temp) /* * per sync group op */ - ellFree (&ca_temp->activeCASGOP); + ellFreeCA (&ca_temp->activeCASGOP); freeListCleanup(ca_temp->ca_sgopFreeListPVT); UNLOCK; diff --git a/src/ca/vxWorks_depen.c b/src/ca/vxWorks_depen.c index fc3996298..99d85441f 100644 --- a/src/ca/vxWorks_depen.c +++ b/src/ca/vxWorks_depen.c @@ -29,6 +29,9 @@ * Modification Log: * ----------------- * $Log$ + * Revision 1.39.4.6 2002/03/14 01:13:58 jhill + * fixed put notify shutdown during channel delete + * * Revision 1.39.4.5 2002/03/13 22:07:58 jhill * improved put notify cleanup when client terminates * @@ -641,12 +644,12 @@ LOCAL int cac_os_depen_exit_tid (struct CA_STATIC *pcas, int tid) status = db_close_events(pcas->ca_evuser); assert(status == OK); - ellFree(&pcas->ca_lcl_buff_list); + ellFreeCA(&pcas->ca_lcl_buff_list); /* * remove local chid blocks, paddr blocks, waiting ev blocks */ - ellFree(&pcas->ca_local_chidlist); + ellFreeCA(&pcas->ca_local_chidlist); freeListCleanup(pcas->ca_dbMonixFreeList); /* diff --git a/src/cas/io/bsdSocket/casDGIntfIO.cc b/src/cas/io/bsdSocket/casDGIntfIO.cc index 3cff361c1..2a6ebd1a6 100644 --- a/src/cas/io/bsdSocket/casDGIntfIO.cc +++ b/src/cas/io/bsdSocket/casDGIntfIO.cc @@ -38,6 +38,30 @@ #include "bsdSocketResource.h" #include "addrList.h" +/**************************************************************************** + * + * The rumor is that windows croaks if the malloc and free are not in the + * same dll. + * + *****************************************************************************/ +static void ellFreeCAS (ELLLIST *pList) +{ + ELLNODE *nnode = pList->node.next; + ELLNODE *pnode; + + while (nnode != NULL) + { + pnode = nnode; + nnode = nnode->next; + free(pnode); + } + pList->node.next = NULL; + pList->node.previous = NULL; + pList->count = 0; + + return; +} + // // casDGIntfIO::casDGIntfIO() // @@ -179,7 +203,7 @@ caStatus casDGIntfIO::init(const caNetAddr &addr, unsigned connectWithThisPortIn ellConcat(&this->beaconAddrList, &BCastAddrList); } else { - ellFree(&BCastAddrList); + ellFreeCAS(&BCastAddrList); } } @@ -239,7 +263,7 @@ casDGIntfIO::~casDGIntfIO() socket_close(this->sock); } - ellFree(&this->beaconAddrList); + ellFreeCAS(&this->beaconAddrList); bsdSockRelease(); } @@ -530,3 +554,5 @@ void casDGIntfIO::processDG() this->client.processDG(*this,*this->pAltOutIO); } + +