From 3ca42fc838eb6994e41ab2ed40690ad080efa708 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 23 Jun 2014 16:28:22 -0400 Subject: [PATCH] cleanup iocsh --- src/ioc/misc/iocInit.c | 1 + src/libCom/iocsh/iocsh.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ioc/misc/iocInit.c b/src/ioc/misc/iocInit.c index 0268801cb..774846848 100644 --- a/src/ioc/misc/iocInit.c +++ b/src/ioc/misc/iocInit.c @@ -659,6 +659,7 @@ int iocShutdown(void) callbackShutdown(); iterateRecords(doFreeRecord, NULL); asShutdown(); + iocshFree(); iocState = iocStopped; return 0; } diff --git a/src/libCom/iocsh/iocsh.cpp b/src/libCom/iocsh/iocsh.cpp index 81727696b..671239781 100644 --- a/src/libCom/iocsh/iocsh.cpp +++ b/src/libCom/iocsh/iocsh.cpp @@ -203,20 +203,22 @@ void epicsShareAPI iocshRegisterVariable (const iocshVarDef *piocshVarDef) */ void epicsShareAPI iocshFree(void) { - struct iocshCommand *pc, *nc; - struct iocshVariable *pv, *nv; + struct iocshCommand *pc; + struct iocshVariable *pv; iocshTableLock (); for (pc = iocshCommandHead ; pc != NULL ; ) { - nc = pc->next; + struct iocshCommand * nc = pc->next; free (pc); pc = nc; } for (pv = iocshVariableHead ; pv != NULL ; ) { - nv = pv->next; + struct iocshVariable *nv = pv->next; free (pv); pv = nv; } + iocshCommandHead = NULL; + iocshVariableHead = NULL; iocshTableUnlock (); }