Ignore:
Timestamp:
May 18, 2018 7:12:41 AM (16 months ago)
Author:
nanang
Message:

Re #2096:

  • Fixed memory leak due to not destroyed DTLS-SRTP keying (when it is not active).
  • DTLS-SRTP must not destroy itself, keying destroy must be initiated by SRTP.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/transport_srtp.c

    r5790 r5794  
    12701270    PJ_ASSERT_RETURN(tp, PJ_EINVAL); 
    12711271 
    1272     /* Close keying */ 
    1273     for (i=0; i < srtp->keying_cnt; i++) 
    1274         pjmedia_transport_close(srtp->keying[i]); 
     1272    /* Close all keying. Note that any keying should not be destroyed before 
     1273     * SRTP transport is destroyed as re-INVITE may initiate new keying method 
     1274     * without destroying SRTP transport. 
     1275     */ 
     1276    for (i=0; i < srtp->all_keying_cnt; i++) 
     1277        pjmedia_transport_close(srtp->all_keying[i]); 
    12751278 
    12761279    /* Close member if configured */ 
     
    16121615            !srtp_crypto_empty(&srtp->rx_policy_neg)) 
    16131616        { 
    1614             /* SRTP nego is done, let's destroy any other keying. */ 
    1615             unsigned j; 
    1616             for (j = 0; j < srtp->keying_cnt; ++j) { 
    1617                 if (j != i) 
    1618                     pjmedia_transport_close(srtp->keying[j]); 
    1619             } 
     1617            /* SRTP nego is done */ 
    16201618            srtp->keying_cnt = 1; 
    16211619            srtp->keying[0] = srtp->keying[i]; 
     
    16831681            !srtp_crypto_empty(&srtp->rx_policy_neg)) 
    16841682        { 
    1685             /* SRTP nego is done, let's destroy any other keying. */ 
    1686             unsigned j; 
    1687             for (j = 0; j < srtp->keying_cnt; ++j) { 
    1688                 if (j != i) 
    1689                     pjmedia_transport_close(srtp->keying[j]); 
    1690             } 
     1683            /* SRTP nego is done */ 
    16911684            srtp->keying_cnt = 1; 
    16921685            srtp->keying[0] = srtp->keying[i]; 
Note: See TracChangeset for help on using the changeset viewer.