summaryrefslogtreecommitdiff
path: root/drivers/unix/ip_unix.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-05-01 08:44:11 +0200
committerGitHub <noreply@github.com>2018-05-01 08:44:11 +0200
commit9834b690aea8ecd6fb079a772df5664ff1bae618 (patch)
tree4378dedf717e6f045caaa7abf748486e3af4d300 /drivers/unix/ip_unix.cpp
parent4cce6f34170d693be994d9a451b4b5f96a084cfb (diff)
parent03bf783f3ce9d2a865bc509035dd883ffe0baa0c (diff)
Merge pull request #18334 from Faless/coverity_net
Various coverity scan fixes, WS FreeBSD fixes
Diffstat (limited to 'drivers/unix/ip_unix.cpp')
-rw-r--r--drivers/unix/ip_unix.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/unix/ip_unix.cpp b/drivers/unix/ip_unix.cpp
index a7fb0c3887..949609bb9a 100644
--- a/drivers/unix/ip_unix.cpp
+++ b/drivers/unix/ip_unix.cpp
@@ -101,7 +101,7 @@ IP_Address IP_Unix::_resolve_hostname(const String &p_hostname, Type p_type) {
hints.ai_family = AF_UNSPEC;
hints.ai_flags = AI_ADDRCONFIG;
};
- hints.ai_flags &= !AI_NUMERICHOST;
+ hints.ai_flags &= ~AI_NUMERICHOST;
int s = getaddrinfo(p_hostname.utf8().get_data(), NULL, &hints, &result);
if (s != 0) {
@@ -111,6 +111,8 @@ IP_Address IP_Unix::_resolve_hostname(const String &p_hostname, Type p_type) {
if (result == NULL || result->ai_addr == NULL) {
ERR_PRINT("Invalid response from getaddrinfo");
+ if (result)
+ freeaddrinfo(result);
return IP_Address();
};