[EMAIL PROTECTED] wrote:
> More leak fixes are in the attachment.
> wxCommunicator can reinitialize sipxtapi during runtime so they manifest
> themselves.
> 
> Jaroslav Libak
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> sipxtapi-dev mailing list
> [email protected]
> List Archive: http://list.sipfoundry.org/archive/sipxtapi-dev/

Again more leak fixes.
If you want to reinitialize sipxtapi then they are necessary.

Jaroslav Libak
Index: interface/CpMediaInterfaceFactoryImpl.cpp
===================================================================
--- interface/CpMediaInterfaceFactoryImpl.cpp   (revision 9091)
+++ interface/CpMediaInterfaceFactoryImpl.cpp   (working copy)
@@ -139,7 +139,7 @@
     if (miNextRtpPort != 0)
     {
         // if it is not already in the list...
-        if (!mlistFreePorts.find(new UtlInt(rtpPort)))
+        if (!mlistFreePorts.find(&UtlInt(rtpPort)))
         {
             // Release port to head of list (generally want to reuse ports)
             mlistFreePorts.insert(new UtlInt(rtpPort)) ;
Index: src/net/SipUserAgent.cpp
===================================================================
--- src/net/SipUserAgent.cpp    (revision 9091)
+++ src/net/SipUserAgent.cpp    (working copy)
@@ -483,6 +483,7 @@
 
     allowedSipMethods.destroyAll();
     mMessageObservers.destroyAll();
+    allowedSipExtensions.destroyAll();
 }
 
 /* ============================ MANIPULATORS ============================== */
Index: src/tapi/SipXEventDispatcher.cpp
===================================================================
--- src/tapi/SipXEventDispatcher.cpp    (revision 9091)
+++ src/tapi/SipXEventDispatcher.cpp    (working copy)
@@ -116,10 +116,12 @@
         assert(pContext != NULL) ;
         if (pContext)
         {
-            if (    pContext->pCallbackProc == pCallbackProc &&
-                    pContext->pUserData == pUserData)
+            if (pContext->pCallbackProc == pCallbackProc &&
+                pContext->pUserData == pUserData)
             {
                 mListeners.destroy(pValue) ;
+                // mListeners.destroy will only delete the UtlVoidPtr object, 
not pContext
+                delete pContext;
                 bRC = true ;
                 break ;
             }
@@ -132,7 +134,18 @@
 void SipXEventDispatcher::removeAllListeners() 
 {
     OsWriteLock lock(mListenerLock) ;
-    mListeners.destroyAll() ;
+
+    UtlHashMapIterator itor(mListeners) ;
+    UtlVoidPtr* pValue ;
+    SIPX_EVENT_LISTENER_CONTEXT* pContext = NULL ;
+
+    while ((pValue = (UtlVoidPtr*) itor()))
+    {
+       pContext = (SIPX_EVENT_LISTENER_CONTEXT*) pValue->getValue() ;
+       // delete tests for NULL value automatically
+       delete pContext;
+    }
+    mListeners.destroyAll();
 }
 
 
_______________________________________________
sipxtapi-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipxtapi-dev/

Reply via email to