diff --git a/help.c b/help.c index 82a5bdb5..0a16d434 100644 --- a/help.c +++ b/help.c @@ -21,6 +21,7 @@ static char *helpDirs = NULL; static char *defaultFile="master.txt"; /*----------------------------------------------------------------------*/ void KillHelp(void *pData){ + KillDummy(pData); if(helpDirs != NULL){ free(helpDirs); helpDirs = NULL; diff --git a/macro.c b/macro.c index ae5740f2..b4abcf96 100644 --- a/macro.c +++ b/macro.c @@ -167,9 +167,9 @@ { if(strcmp(lastCommand,comBuffer) == 0) { - Tcl_AppendResult(pInter,"ERROR: Never ending loop in unknown\n", + Tcl_AppendResult(pInter,"ERROR: Never ending loop in unknown\n", "Offending command: ",comBuffer, - "Probably Tcl command not found",NULL); + " Probably Tcl command not found",NULL); SCSetInterrupt(pCon,eAbortBatch); return TCL_ERROR; } @@ -218,6 +218,13 @@ free(pData); pUnbekannt = NULL; } + /*-----------------------------------------------------------------------*/ + void KillSicsUnknown(void) { + if (pUnbekannt) { + UnknownKill(pUnbekannt); + pUnbekannt = NULL; + } + } /*------------------------------------------------------------------------ Implementation of a protected exec command --------------------------------------------------------------------------*/ diff --git a/macro.h b/macro.h index 2e1d6c18..a3b1d535 100644 --- a/macro.h +++ b/macro.h @@ -46,6 +46,7 @@ int MacroPush(SConnection *pCon); int MacroPop(void); + void KillSicsUnknown(void); #endif diff --git a/nserver.c b/nserver.c index 48021717..10aba0c9 100644 --- a/nserver.c +++ b/nserver.c @@ -177,7 +177,7 @@ TaskRegister(self->pTasker, NetReaderTask, NetReaderSignal, - DeleteNetReader, + NULL, /* call DeleteNetReader later than TaskerDelete */ pReader,1); self->pReader = pReader; @@ -187,24 +187,24 @@ { printf("Cannot find ServerPort number in options file %s\n", "This value is required!"); - IFDeleteOptions(pSICSOptions); DeleteInterp(self->pSics); + IFDeleteOptions(pSICSOptions); return 0; } iRet = sscanf(pText,"%d",&iPort); if( (iRet != 1) || (iPort < 1024) ) { printf("Invalid port number specified in Server initialisation file\n"); - IFDeleteOptions(pSICSOptions); DeleteInterp(self->pSics); + IFDeleteOptions(pSICSOptions); return 0; } self->pServerPort = NETOpenPort(iPort); if(!self->pServerPort) { printf("Cannot open Server Socket\n"); - IFDeleteOptions(pSICSOptions); DeleteInterp(self->pSics); + IFDeleteOptions(pSICSOptions); return 0; } NetReadRegister(pReader, self->pServerPort, naccept, NULL); @@ -222,16 +222,16 @@ { printf("Cannot find InterruptPort number in options file %s\n", "This value is required!"); - IFDeleteOptions(pSICSOptions); DeleteInterp(self->pSics); + IFDeleteOptions(pSICSOptions); return 0; } iRet = sscanf(pText,"%d",&iPort); if( (iRet != 1) || (iPort < 1024) ) { printf("Invalid port number specified in Server initialisation file\n"); - IFDeleteOptions(pSICSOptions); DeleteInterp(self->pSics); + IFDeleteOptions(pSICSOptions); return 0; } iRet = ServerSetupInterrupt(iPort,pReader,self->pTasker); @@ -310,7 +310,6 @@ /* shut tasker down */ TaskerDelete(&self->pTasker); self->pTasker = NULL; - self->pReader = NULL; /* save status */ if(!self->simMode) @@ -345,14 +344,20 @@ } /* clean out */ - if(pSICSOptions) - IFDeleteOptions(pSICSOptions); if(self->pSics) { DeleteInterp(self->pSics); self->pSics = NULL; } + /* remove options after interpreter as some object kill functions + may use options */ + if(pSICSOptions) + IFDeleteOptions(pSICSOptions); + /* delete net reader */ + DeleteNetReader(self->pReader); + self->pReader = NULL; + /* close the server port */ if(self->pServerPort) { @@ -388,11 +393,15 @@ /* close the List system */ LLDsystemClose(); + KillFreeConnections(); + + /* make fortify print his findings */ Fortify_DumpAllMemory(iFortifyScope); Fortify_LeaveScope(); - + free(self); + } /*------------------------------------------------------------------------*/ void RunServer(pServer self)