mirror of https://github.com/coturn/coturn
Fix memory and resource leaks in udp_create_server_socket( ) (#1714)
### Describe Hi, Fixes resource and memory leaks in `udp_create_server_socket()` by ensuring that the socket file descriptor (`udp_fd`) and dynamically allocated memory (`server_addr`) are properly released on failure. Specifically, if `addr_bind()`, `event_new()`, or `event_add()` fails, the function now closes the socket and frees memory to prevent leaks. ### Expected Behavior On any failure during socket binding or event registration, both `udp_fd` and `server_addr` should be released to avoid leaking system resources. ### Actual Behavior Previously, if `addr_bind()`, `event_new()`, or `event_add()` failed, the function would return early without closing the socket or freeing memory, causing file descriptor and heap memory leaks. This patch addresses overlooked memory and resource cleanup on failure paths, improving server stability through targeted and essential changes. Thanks for reviewing. Co-authored-by: Gustavo Garcia <gustavogb@gmail.com>pull/1695/merge
parent
2944775261
commit
5ab95e1a5a
Loading…
Reference in new issue