[asterisk-commits] may: trunk r343448 - in /trunk: ./ addons/ooh323c/src/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Nov 4 14:50:14 CDT 2011
Author: may
Date: Fri Nov 4 14:50:10 2011
New Revision: 343448
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=343448
Log:
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
Modified:
trunk/ (props changed)
trunk/addons/ooh323c/src/dlist.c
trunk/addons/ooh323c/src/dlist.h
trunk/addons/ooh323c/src/ooGkClient.c
trunk/addons/ooh323c/src/ooTimer.c
trunk/addons/ooh323c/src/ooq931.c
trunk/addons/ooh323c/src/printHandler.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.
Modified: trunk/addons/ooh323c/src/dlist.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/dlist.c?view=diff&rev=343448&r1=343447&r2=343448
==============================================================================
--- trunk/addons/ooh323c/src/dlist.c (original)
+++ trunk/addons/ooh323c/src/dlist.c Fri Nov 4 14:50:10 2011
@@ -135,7 +135,7 @@
pList->count--;
}
-void dListFindAndRemove(DList* pList, void *data)
+void dListFindAndRemove(struct OOCTXT* pctxt, DList* pList, void *data)
{
DListNode *pNode, *pNextNode;
for(pNode = pList->head; pNode !=0; pNode = pNextNode){
@@ -143,8 +143,10 @@
if(pNode->data == data) /* pointer comparison*/
break;
}
- if(pNode)
+ if(pNode) {
dListRemove(pList, pNode);
+ memFreePtr(pctxt, pNode);
+ }
}
DListNode* dListFindByIndex (DList* pList, int index)
Modified: trunk/addons/ooh323c/src/dlist.h
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/dlist.h?view=diff&rev=343448&r1=343447&r2=343448
==============================================================================
--- trunk/addons/ooh323c/src/dlist.h (original)
+++ trunk/addons/ooh323c/src/dlist.h Fri Nov 4 14:50:10 2011
@@ -192,7 +192,7 @@
* already be in the linked list structure.
*/
EXTERN void dListRemove (DList* pList, DListNode* node);
-void dListFindAndRemove(DList* pList, void* data);
+EXTERN void dListFindAndRemove(struct OOCTXT* pctxt, DList* pList, void* data);
/**
* @}
Modified: trunk/addons/ooh323c/src/ooGkClient.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/ooGkClient.c?view=diff&rev=343448&r1=343447&r2=343448
==============================================================================
--- trunk/addons/ooh323c/src/ooGkClient.c (original)
+++ trunk/addons/ooh323c/src/ooGkClient.c Fri Nov 4 14:50:10 2011
@@ -365,7 +365,7 @@
int ooGkClientReceive(ooGkClient *pGkClient)
{
- ASN1OCTET recvBuf[1024];
+ ASN1OCTET recvBuf[ASN_K_ENCBUFSIZ];
int recvLen;
char remoteHost[32];
int iFromPort=0;
@@ -376,7 +376,7 @@
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 @@
memFreePtr(&pGkClient->ctxt, pTimer->cbData);
ooTimerDelete(&pGkClient->ctxt, &pGkClient->timerList, pTimer);
OOTRACEDBGA1("Deleted GRQ Timer.\n");
- break;
}
}
@@ -1064,7 +1063,7 @@
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 @@
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 @@
memFreePtr(&pGkClient->ctxt, pTimer->cbData);
ooTimerDelete(&pGkClient->ctxt, &pGkClient->timerList, pTimer);
OOTRACEDBGA1("Deleted RRQ Timer.\n");
- break;
}
}
Modified: trunk/addons/ooh323c/src/ooTimer.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/ooTimer.c?view=diff&rev=343448&r1=343447&r2=343448
==============================================================================
--- trunk/addons/ooh323c/src/ooTimer.c (original)
+++ trunk/addons/ooh323c/src/ooTimer.c Fri Nov 4 14:50:10 2011
@@ -79,7 +79,7 @@
void ooTimerDelete (OOCTXT* pctxt, DList *pList, OOTimer* pTimer)
{
- dListFindAndRemove (pList, pTimer);
+ dListFindAndRemove (pctxt, pList, pTimer);
memFreePtr (pctxt, pTimer);
}
@@ -115,7 +115,7 @@
stat = (*pTimer->timeoutCB)(pTimer->cbData);
- if (0 != stat || !pTimer->reRegister) {
+ if (!pTimer->reRegister) {
ooTimerDelete (pctxt, pList, pTimer);
}
}
@@ -175,7 +175,7 @@
void ooTimerReset (OOCTXT* pctxt, DList *pList, OOTimer* pTimer)
{
if (pTimer->reRegister) {
- dListFindAndRemove (pList, pTimer);
+ dListFindAndRemove (pctxt, pList, pTimer);
ooTimerComputeExpireTime (pTimer);
ooTimerInsertEntry (pctxt, pList, pTimer);
}
Modified: trunk/addons/ooh323c/src/ooq931.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/ooq931.c?view=diff&rev=343448&r1=343447&r2=343448
==============================================================================
--- trunk/addons/ooh323c/src/ooq931.c (original)
+++ trunk/addons/ooh323c/src/ooq931.c Fri Nov 4 14:50:10 2011
@@ -512,7 +512,7 @@
int ooEncodeUUIE(OOCTXT* pctxt, Q931Message *q931msg)
{
- ASN1OCTET msgbuf[1024];
+ ASN1OCTET msgbuf[ASN_K_ENCBUFSIZ];
ASN1OCTET * msgptr=NULL;
int len;
ASN1BOOL aligned = TRUE;
Modified: trunk/addons/ooh323c/src/printHandler.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/ooh323c/src/printHandler.c?view=diff&rev=343448&r1=343447&r2=343448
==============================================================================
--- trunk/addons/ooh323c/src/printHandler.c (original)
+++ trunk/addons/ooh323c/src/printHandler.c Fri Nov 4 14:50:10 2011
@@ -30,6 +30,7 @@
#include "ootrace.h"
EventHandler printHandler;
+AST_MUTEX_DEFINE_STATIC(printlock);
static const char* pVarName;
static int gIndentSpaces;
@@ -60,6 +61,7 @@
printHandler->enumValue = &printEnumValue;
printHandler->openTypeValue = &printOpenTypeValue;
pVarName = varname;
+ ast_mutex_lock(&printlock);
OOTRACEDBGB2("%s = {\n", pVarName);
gIndentSpaces += 3;
@@ -72,6 +74,8 @@
if (gIndentSpaces != 0) {
OOTRACEDBGB1 ("ERROR: unbalanced structure\n");
}
+ gIndentSpaces = 0;
+ ast_mutex_unlock(&printlock);
}
void indent ()
More information about the asterisk-commits
mailing list