Final fix memleaks in GkClient codes, same for Timer codes.

(these memleaks stop development of gk codes, now i can continue)
Fix printHandler 'Unbalanced Structure' issues with locking printHandler
data for single thread.
........

Merged revisions 343281 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 343445 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@343448 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Alexandr Anikin
2011-11-04 19:50:10 +00:00
parent 969f4aa3d6
commit c580b163b5
6 changed files with 18 additions and 12 deletions

View File

@@ -365,7 +365,7 @@ void ooGkClientFillVendor
int ooGkClientReceive(ooGkClient *pGkClient)
{
ASN1OCTET recvBuf[1024];
ASN1OCTET recvBuf[ASN_K_ENCBUFSIZ];
int recvLen;
char remoteHost[32];
int iFromPort=0;
@@ -376,7 +376,7 @@ int ooGkClientReceive(ooGkClient *pGkClient)
ast_mutex_lock(&pGkClient->Lock);
pctxt = &pGkClient->msgCtxt;
recvLen = ooSocketRecvFrom(pGkClient->rasSocket, recvBuf, 1024, remoteHost,
recvLen = ooSocketRecvFrom(pGkClient->rasSocket, recvBuf, 2048, remoteHost,
32, &iFromPort);
if(recvLen <0)
{
@@ -859,7 +859,6 @@ int ooGkClientHandleGatekeeperConfirm
memFreePtr(&pGkClient->ctxt, pTimer->cbData);
ooTimerDelete(&pGkClient->ctxt, &pGkClient->timerList, pTimer);
OOTRACEDBGA1("Deleted GRQ Timer.\n");
break;
}
}
@@ -1064,7 +1063,7 @@ int ooGkClientSendRRQ(ooGkClient *pGkClient, ASN1BOOL keepAlive)
allocate storage for endpoint-identifier, and populate it from what the
GK told us from the previous RCF. Only allocate on the first pass thru here */
pRegReq->endpointIdentifier.data =
(ASN116BITCHAR*)memAlloc(pctxt, pGkClient->gkId.nchars*sizeof(ASN116BITCHAR));
(ASN116BITCHAR*)memAlloc(pctxt, pGkClient->endpointId.nchars*sizeof(ASN116BITCHAR));
if (pRegReq->endpointIdentifier.data) {
pRegReq->endpointIdentifier.nchars = pGkClient->endpointId.nchars;
pRegReq->m.endpointIdentifierPresent = TRUE;
@@ -1137,6 +1136,8 @@ int ooGkClientHandleRegistrationConfirm
ooGkClientTimerCb *cbData;
ASN1UINT regTTL=0;
/* Extract Endpoint Id */
if (pGkClient->endpointId.data)
memFreePtr(&pGkClient->ctxt, pGkClient->endpointId.data);
pGkClient->endpointId.nchars =
pRegistrationConfirm->endpointIdentifier.nchars;
pGkClient->endpointId.data = (ASN116BITCHAR*)memAlloc(&pGkClient->ctxt,
@@ -1289,7 +1290,6 @@ int ooGkClientHandleRegistrationReject
memFreePtr(&pGkClient->ctxt, pTimer->cbData);
ooTimerDelete(&pGkClient->ctxt, &pGkClient->timerList, pTimer);
OOTRACEDBGA1("Deleted RRQ Timer.\n");
break;
}
}