- Introducted Arg2Tcl as a replacement for some calls to Arg2Text

- Fixed a memory leak
This commit is contained in:
zolliker
2006-04-11 07:26:55 +00:00
parent e25fb68080
commit da3dfd9d76
11 changed files with 184 additions and 92 deletions

View File

@ -132,7 +132,10 @@ extern pServer pServ;
}
do
{ /* loop until an unused ident is found */
{ /* loop until an unused ident is found. This test needed only for
the case there some object has already the name con<nnn>.
In a live cycle of SICS, no connection ever can get an earlier
used name */
if (lastIdent == LONG_MAX)
{
/* This is a serious, very serious error! */
@ -1721,7 +1724,8 @@ static void writeToLogFiles(SConnection *self, char *buffer)
Item sItem;
pCBAction pCB = NULL;
CommandList *pCom = NULL;
int iMacro;
int iMacro;
char *script;
self = (SConnection *)pData;
if(!VerifyConnection(self))
@ -1781,17 +1785,18 @@ static void writeToLogFiles(SConnection *self, char *buffer)
return 0;
}
script = Arg2Tcl(argc-4, &argv[4], NULL, 0);
/* now we can install the callback */
pCB = (pCBAction)malloc(sizeof(CBAction));
if(!pCB)
if(!pCB || !script)
{
SCWrite(pCon,"ERROR: memory exhausted in SConnection",eError);
return 0;
}
Arg2Text(argc-4, &argv[4],pBueffel,1023);
pCB->pCon = pCon;
pCB->pSics = pSics;
pCB->pAction = strdup(pBueffel);
pCB->pAction = script;
sItem.pInterface = pInterface;
sItem.lID = RegisterCallback(pInterface, SCGetContext(pCB->pCon), iEvent, ConCallBack,
pCB, CBKill);