Language: C
Label: safe
CWE: CWE-416 \u2014 Use After Free
Referencing memory after it has been freed can cause a program to crash, use unexpected values, or execute code.

Code:
static pj_status_t transport_destroy(pjmedia_transport *tp)
{
    struct transport_ice *tp_ice = (struct transport_ice*)tp;

    PJ_LOG(4, (tp_ice->base.name, "Destroying ICE transport"));

    /* Reset callback and user data */
    pj_bzero(&tp_ice->cb, sizeof(tp_ice->cb));
    tp_ice->base.user_data = NULL;
    tp_ice->rtp_cb = NULL;
    tp_ice->rtp_cb2 = NULL;
    tp_ice->rtcp_cb = NULL;

    if (tp_ice->ice_st) {
        pj_grp_lock_t *grp_lock = pj_ice_strans_get_grp_lock(tp_ice->ice_st);
        pj_ice_strans_destroy(tp_ice->ice_st);
        tp_ice->ice_st = NULL;
        pj_grp_lock_dec_ref(grp_lock);
    } else {
        tp_ice_on_destroy(tp);
    }

    return PJ_SUCCESS;
}