Bug 925896 - Signaling - Addref when adding sessiondata_t to hash r=abr
authorEthan Hugg <ethanhugg@gmail.com>
Tue, 22 Oct 2013 13:14:43 -0700
changeset 166497 30c52c82e37b7ed3a95a0e1d3b0c9959568d5c20
parent 166496 67e2829b7706feaad8ebddd31e968a7f469e8876
child 166498 a2622f8515348b0fff48b5774dcdc05e2d2c99b8
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersabr
bugs925896
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 925896 - Signaling - Addref when adding sessiondata_t to hash r=abr
media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c
--- a/media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c
+++ b/media/webrtc/signaling/src/sipcc/core/ccapp/ccprovider.c
@@ -1516,16 +1516,18 @@ static void ccappUpdateSessionData (sess
         /*
          * If phone was idle, we not going to active state
          * send notification to resetmanager that we
          * are no longer resetReady.
          */
         if ((CCAPI_DeviceInfo_isPhoneIdle(handle) == TRUE) && (sendResetUpdates)) {
             resetNotReady();
         }
+        /* Increment the refcount before putting it in the hashtable */
+        CCAPI_Call_retainCallInfo(data);
         (void) addhash(data->sess_id, data);
             }
 
             //The update accordingly
             switch (sessUpd->eventID) {
             case CALL_INFORMATION:
                 data->clg_name = ccsnap_EscapeStrToLocaleStr(data->clg_name, sessUpd->update.ccSessionUpd.data.call_info.clgName, LEN_UNKNOWN);
                 data->cld_name = ccsnap_EscapeStrToLocaleStr(data->cld_name, sessUpd->update.ccSessionUpd.data.call_info.cldName, LEN_UNKNOWN);
@@ -1577,22 +1579,21 @@ static void ccappUpdateSessionData (sess
 
     CCAPP_DEBUG(DEB_F_PREFIX"Found data for sessid %x event %d",
             DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname), sessUpd->sessionID, sessUpd->eventID);
 	switch(sessUpd->eventID) {
 	case CALL_SESSION_CLOSED:
 	    // find and deep free then delete
         sess_data_p = (session_data_t *)findhash(sessUpd->sessionID);
         if ( sess_data_p != NULL ){
-            cleanSessionData(sess_data_p);
             if ( 0 >  delhash(sessUpd->sessionID) ) {
                 APP_ERR_MSG (DEB_F_PREFIX"failed to delete hash sessid=0x%08x",
-                        DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),sessUpd->sessionID);
+                    DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),sessUpd->sessionID);
             }
-            cpr_free(sess_data_p);
+            CCAPI_Call_releaseCallInfo(sess_data_p);
         }
         if ( (gCCApp.inPreservation || (gCCApp.cucm_mode == FALLBACK)) && isNoCallExist()) {
             /* The phone is now Idle. Clear the inPreservation Flag */
             gCCApp.inPreservation = FALSE;
             proceedWithFOFB();
         }
         if ((CCAPI_DeviceInfo_isPhoneIdle(handle) == TRUE) && (sendResetUpdates)) {
             resetReady();
@@ -1636,23 +1637,22 @@ static void ccappUpdateSessionData (sess
                                 "CallEND", data->line, data->id);
             }
             //>
 
             if (data->state == ONHOOK) {
                 // find and deep free then delete
                 sess_data_p = (session_data_t *)findhash(sessUpd->sessionID);
                 if ( sess_data_p != NULL ){
-                    cleanSessionData(sess_data_p);
                     if ( 0 >  delhash(sessUpd->sessionID) ) {
-                          APP_ERR_MSG (DEB_F_PREFIX"failed to delete hash sessid=0x%08x",
-                                    DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),sessUpd->sessionID);
-                  	}
-                        cpr_free(sess_data_p);
-                     data = NULL;
+                        APP_ERR_MSG (DEB_F_PREFIX"failed to delete hash sessid=0x%08x",
+                            DEB_F_PREFIX_ARGS(SIP_CC_PROV, fname),sessUpd->sessionID);
+                    }
+                    CCAPI_Call_releaseCallInfo(sess_data_p);
+                    data = NULL;
                  }
                 if ((gCCApp.inPreservation || (gCCApp.cucm_mode == FALLBACK)) && isNoCallExist()) {
                     /* The phone is now Idle. Clear the inPreservation Flag */
                     gCCApp.inPreservation = FALSE;
                     proceedWithFOFB();
                 }
                 if ((CCAPI_DeviceInfo_isPhoneIdle(handle) == TRUE) && (sendResetUpdates)) {
                     resetReady();