Add missing close socket when ioa_socket call fails (#1694)
Fixes [#1071](https://github.com/coturn/coturn/issues/1071) Not sure how this case can happen but better to handle the error case. Co-authored-by: tyranron <tyranron@gmail.com>
This commit is contained in:
parent
9ae1e3b3cb
commit
d7197fa263
@ -4384,6 +4384,10 @@ static int create_relay_connection(turn_turnserver *server, ts_ur_super_session
|
|||||||
|
|
||||||
if (get_ioa_socket_type(newelem->s) != TCP_SOCKET) {
|
if (get_ioa_socket_type(newelem->s) != TCP_SOCKET) {
|
||||||
if (register_callback_on_ioa_socket(server->e, newelem->s, IOA_EV_READ, peer_input_handler, ss, 0) < 0) {
|
if (register_callback_on_ioa_socket(server->e, newelem->s, IOA_EV_READ, peer_input_handler, ss, 0) < 0) {
|
||||||
|
IOA_CLOSE_SOCKET(newelem->s);
|
||||||
|
IOA_CLOSE_SOCKET(rtcp_s);
|
||||||
|
*err_code = 500;
|
||||||
|
*reason = (const uint8_t *)"Wrong initialization (internal error)";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user