res_pjsip_transport_websocket: Fix use-after-free bugs.