Changeset 4344


Ignore:
Timestamp:
Feb 8, 2013 7:33:23 AM (11 years ago)
Author:
nanang
Message:

Re #1610: Workaround for crash in sess_on_send_msg() callback

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjnath/src/pjnath/stun_sock.c

    r4343 r4344  
    391391    } 
    392392 
     393    if (stun_sock->stun_sess) { 
     394        pj_stun_session_set_user_data(stun_sock->stun_sess, NULL); 
     395    } 
     396     
    393397    /* Destroy the active socket first just in case we'll get 
    394398     * stray callback. 
    395399     */ 
    396400    if (stun_sock->active_sock != NULL) { 
    397         pj_activesock_set_user_data(stun_sock->active_sock, NULL); 
    398         pj_activesock_close(stun_sock->active_sock); 
     401        pj_activesock_t *asock = stun_sock->active_sock; 
    399402        stun_sock->active_sock = NULL; 
    400403        stun_sock->sock_fd = PJ_INVALID_SOCKET; 
     404        pj_activesock_set_user_data(asock, NULL); 
     405        pj_activesock_close(asock); 
    401406    } else if (stun_sock->sock_fd != PJ_INVALID_SOCKET) { 
    402407        pj_sock_close(stun_sock->sock_fd); 
     
    621626 
    622627    stun_sock = (pj_stun_sock *) pj_stun_session_get_user_data(sess); 
     628    if (!stun_sock || !stun_sock->active_sock) 
     629        return PJ_EINVALIDOP; 
    623630 
    624631    pj_assert(token==INTERNAL_MSG_TOKEN); 
     
    649656 
    650657    stun_sock = (pj_stun_sock *) pj_stun_session_get_user_data(sess); 
     658    if (!stun_sock) 
     659        return; 
    651660 
    652661    PJ_UNUSED_ARG(tdata); 
Note: See TracChangeset for help on using the changeset viewer.