Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: SrsAutoFree addrinfo #2886

Merged
merged 2 commits into from
Jan 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion trunk/src/kernel/srs_kernel_utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ string srs_dns_resolve(string host, int& family)
hints.ai_family = family;

addrinfo* r = NULL;
SrsAutoFree(addrinfo, r);
SrsAutoFreeH(addrinfo, r, freeaddrinfo);
if(getaddrinfo(host.c_str(), NULL, &hints, &r)) {
return "";
}
Expand Down
6 changes: 3 additions & 3 deletions trunk/src/protocol/srs_service_st.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ srs_error_t srs_tcp_connect(string server, int port, srs_utime_t tm, srs_netfd_t
hints.ai_socktype = SOCK_STREAM;

addrinfo* r = NULL;
SrsAutoFree(addrinfo, r);
SrsAutoFreeH(addrinfo, r, freeaddrinfo);
if(getaddrinfo(server.c_str(), sport, (const addrinfo*)&hints, &r)) {
return srs_error_new(ERROR_SYSTEM_IP_INVALID, "get address info");
}
Expand Down Expand Up @@ -248,7 +248,7 @@ srs_error_t srs_tcp_listen(std::string ip, int port, srs_netfd_t* pfd)
hints.ai_flags = AI_NUMERICHOST;

addrinfo* r = NULL;
SrsAutoFreeF(addrinfo, r);
SrsAutoFreeH(addrinfo, r, freeaddrinfo);
if(getaddrinfo(ip.c_str(), sport, (const addrinfo*)&hints, &r)) {
return srs_error_new(ERROR_SYSTEM_IP_INVALID, "getaddrinfo hints=(%d,%d,%d)",
hints.ai_family, hints.ai_socktype, hints.ai_flags);
Expand Down Expand Up @@ -309,7 +309,7 @@ srs_error_t srs_udp_listen(std::string ip, int port, srs_netfd_t* pfd)
hints.ai_flags = AI_NUMERICHOST;

addrinfo* r = NULL;
SrsAutoFree(addrinfo, r);
SrsAutoFreeH(addrinfo, r, freeaddrinfo);
if(getaddrinfo(ip.c_str(), sport, (const addrinfo*)&hints, &r)) {
return srs_error_new(ERROR_SYSTEM_IP_INVALID, "getaddrinfo hints=(%d,%d,%d)",
hints.ai_family, hints.ai_socktype, hints.ai_flags);
Expand Down