cleanup iocsh

This commit is contained in:
Michael Davidsaver
2014-06-23 16:28:22 -04:00
committed by Michael Davidsaver
parent ad2bb0725d
commit 3ca42fc838
2 changed files with 7 additions and 4 deletions

View File

@@ -659,6 +659,7 @@ int iocShutdown(void)
callbackShutdown();
iterateRecords(doFreeRecord, NULL);
asShutdown();
iocshFree();
iocState = iocStopped;
return 0;
}

View File

@@ -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 ();
}