make shutdown more proper (releasing all memory)
This commit is contained in:
1
help.c
1
help.c
@ -21,6 +21,7 @@ static char *helpDirs = NULL;
|
|||||||
static char *defaultFile="master.txt";
|
static char *defaultFile="master.txt";
|
||||||
/*----------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------*/
|
||||||
void KillHelp(void *pData){
|
void KillHelp(void *pData){
|
||||||
|
KillDummy(pData);
|
||||||
if(helpDirs != NULL){
|
if(helpDirs != NULL){
|
||||||
free(helpDirs);
|
free(helpDirs);
|
||||||
helpDirs = NULL;
|
helpDirs = NULL;
|
||||||
|
11
macro.c
11
macro.c
@ -167,9 +167,9 @@
|
|||||||
{
|
{
|
||||||
if(strcmp(lastCommand,comBuffer) == 0)
|
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,
|
"Offending command: ",comBuffer,
|
||||||
"Probably Tcl command not found",NULL);
|
" Probably Tcl command not found",NULL);
|
||||||
SCSetInterrupt(pCon,eAbortBatch);
|
SCSetInterrupt(pCon,eAbortBatch);
|
||||||
return TCL_ERROR;
|
return TCL_ERROR;
|
||||||
}
|
}
|
||||||
@ -218,6 +218,13 @@
|
|||||||
free(pData);
|
free(pData);
|
||||||
pUnbekannt = NULL;
|
pUnbekannt = NULL;
|
||||||
}
|
}
|
||||||
|
/*-----------------------------------------------------------------------*/
|
||||||
|
void KillSicsUnknown(void) {
|
||||||
|
if (pUnbekannt) {
|
||||||
|
UnknownKill(pUnbekannt);
|
||||||
|
pUnbekannt = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
/*------------------------------------------------------------------------
|
/*------------------------------------------------------------------------
|
||||||
Implementation of a protected exec command
|
Implementation of a protected exec command
|
||||||
--------------------------------------------------------------------------*/
|
--------------------------------------------------------------------------*/
|
||||||
|
1
macro.h
1
macro.h
@ -46,6 +46,7 @@
|
|||||||
int MacroPush(SConnection *pCon);
|
int MacroPush(SConnection *pCon);
|
||||||
int MacroPop(void);
|
int MacroPop(void);
|
||||||
|
|
||||||
|
void KillSicsUnknown(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
29
nserver.c
29
nserver.c
@ -177,7 +177,7 @@
|
|||||||
TaskRegister(self->pTasker,
|
TaskRegister(self->pTasker,
|
||||||
NetReaderTask,
|
NetReaderTask,
|
||||||
NetReaderSignal,
|
NetReaderSignal,
|
||||||
DeleteNetReader,
|
NULL, /* call DeleteNetReader later than TaskerDelete */
|
||||||
pReader,1);
|
pReader,1);
|
||||||
self->pReader = pReader;
|
self->pReader = pReader;
|
||||||
|
|
||||||
@ -187,24 +187,24 @@
|
|||||||
{
|
{
|
||||||
printf("Cannot find ServerPort number in options file %s\n",
|
printf("Cannot find ServerPort number in options file %s\n",
|
||||||
"This value is required!");
|
"This value is required!");
|
||||||
IFDeleteOptions(pSICSOptions);
|
|
||||||
DeleteInterp(self->pSics);
|
DeleteInterp(self->pSics);
|
||||||
|
IFDeleteOptions(pSICSOptions);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
iRet = sscanf(pText,"%d",&iPort);
|
iRet = sscanf(pText,"%d",&iPort);
|
||||||
if( (iRet != 1) || (iPort < 1024) )
|
if( (iRet != 1) || (iPort < 1024) )
|
||||||
{
|
{
|
||||||
printf("Invalid port number specified in Server initialisation file\n");
|
printf("Invalid port number specified in Server initialisation file\n");
|
||||||
IFDeleteOptions(pSICSOptions);
|
|
||||||
DeleteInterp(self->pSics);
|
DeleteInterp(self->pSics);
|
||||||
|
IFDeleteOptions(pSICSOptions);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
self->pServerPort = NETOpenPort(iPort);
|
self->pServerPort = NETOpenPort(iPort);
|
||||||
if(!self->pServerPort)
|
if(!self->pServerPort)
|
||||||
{
|
{
|
||||||
printf("Cannot open Server Socket\n");
|
printf("Cannot open Server Socket\n");
|
||||||
IFDeleteOptions(pSICSOptions);
|
|
||||||
DeleteInterp(self->pSics);
|
DeleteInterp(self->pSics);
|
||||||
|
IFDeleteOptions(pSICSOptions);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
NetReadRegister(pReader, self->pServerPort, naccept, NULL);
|
NetReadRegister(pReader, self->pServerPort, naccept, NULL);
|
||||||
@ -222,16 +222,16 @@
|
|||||||
{
|
{
|
||||||
printf("Cannot find InterruptPort number in options file %s\n",
|
printf("Cannot find InterruptPort number in options file %s\n",
|
||||||
"This value is required!");
|
"This value is required!");
|
||||||
IFDeleteOptions(pSICSOptions);
|
|
||||||
DeleteInterp(self->pSics);
|
DeleteInterp(self->pSics);
|
||||||
|
IFDeleteOptions(pSICSOptions);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
iRet = sscanf(pText,"%d",&iPort);
|
iRet = sscanf(pText,"%d",&iPort);
|
||||||
if( (iRet != 1) || (iPort < 1024) )
|
if( (iRet != 1) || (iPort < 1024) )
|
||||||
{
|
{
|
||||||
printf("Invalid port number specified in Server initialisation file\n");
|
printf("Invalid port number specified in Server initialisation file\n");
|
||||||
IFDeleteOptions(pSICSOptions);
|
|
||||||
DeleteInterp(self->pSics);
|
DeleteInterp(self->pSics);
|
||||||
|
IFDeleteOptions(pSICSOptions);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
iRet = ServerSetupInterrupt(iPort,pReader,self->pTasker);
|
iRet = ServerSetupInterrupt(iPort,pReader,self->pTasker);
|
||||||
@ -310,7 +310,6 @@
|
|||||||
/* shut tasker down */
|
/* shut tasker down */
|
||||||
TaskerDelete(&self->pTasker);
|
TaskerDelete(&self->pTasker);
|
||||||
self->pTasker = NULL;
|
self->pTasker = NULL;
|
||||||
self->pReader = NULL;
|
|
||||||
|
|
||||||
/* save status */
|
/* save status */
|
||||||
if(!self->simMode)
|
if(!self->simMode)
|
||||||
@ -345,14 +344,20 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* clean out */
|
/* clean out */
|
||||||
if(pSICSOptions)
|
|
||||||
IFDeleteOptions(pSICSOptions);
|
|
||||||
if(self->pSics)
|
if(self->pSics)
|
||||||
{
|
{
|
||||||
DeleteInterp(self->pSics);
|
DeleteInterp(self->pSics);
|
||||||
self->pSics = NULL;
|
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 */
|
/* close the server port */
|
||||||
if(self->pServerPort)
|
if(self->pServerPort)
|
||||||
{
|
{
|
||||||
@ -388,11 +393,15 @@
|
|||||||
/* close the List system */
|
/* close the List system */
|
||||||
LLDsystemClose();
|
LLDsystemClose();
|
||||||
|
|
||||||
|
KillFreeConnections();
|
||||||
|
|
||||||
|
|
||||||
/* make fortify print his findings */
|
/* make fortify print his findings */
|
||||||
Fortify_DumpAllMemory(iFortifyScope);
|
Fortify_DumpAllMemory(iFortifyScope);
|
||||||
Fortify_LeaveScope();
|
Fortify_LeaveScope();
|
||||||
|
|
||||||
free(self);
|
free(self);
|
||||||
|
|
||||||
}
|
}
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
void RunServer(pServer self)
|
void RunServer(pServer self)
|
||||||
|
Reference in New Issue
Block a user