[asterisk-scf-commits] asterisk-scf/release/sip.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue Jan 17 12:17:38 CST 2012


branch "master" has been updated
       via  dd69b74a39e35efd82b59087c3f69224ccee531e (commit)
      from  d674b4ff321ff8eeb2581246115d820c152c7214 (commit)

Summary of changes:
 src/STUNModule.cpp |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)


- Log -----------------------------------------------------------------
commit dd69b74a39e35efd82b59087c3f69224ccee531e
Author: Brent Eagles <beagles at digium.com>
Date:   Tue Jan 17 14:29:49 2012 -0330

    Fix the STUN module's destroyImpl() implementation so it only attempts to
    release the resources once. The previous impl would likely crash if
    destroy() was called because the cleanup was attempted once again in the
    destructor.

diff --git a/src/STUNModule.cpp b/src/STUNModule.cpp
index 0af4cac..bdb917b 100644
--- a/src/STUNModule.cpp
+++ b/src/STUNModule.cpp
@@ -149,10 +149,18 @@ STUNModule::STUNModule(const boost::shared_ptr<pj_stun_config>& config) :
 void STUNModule::destroyImpl()
 {
     boost::unique_lock<boost::shared_mutex> lock(mLock);
-    pj_ioqueue_destroy(mConfig->ioqueue);
-    pj_timer_heap_destroy(mConfig->timer_heap);
-    pj_pool_release(mPool);
-    mConfig.reset();
+    //
+    // The check for null on mConfig is necessary because if destroy() is
+    // called (which it might), the destructor is going to run through this
+    // code again.
+    //
+    if (mConfig)
+    {
+        pj_ioqueue_destroy(mConfig->ioqueue);
+        pj_timer_heap_destroy(mConfig->timer_heap);
+        pj_pool_release(mPool);
+        mConfig.reset();
+    }
 }
 }
 }

-----------------------------------------------------------------------


-- 
asterisk-scf/release/sip.git



More information about the asterisk-scf-commits mailing list