You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ji...@apache.org on 2015/04/22 20:26:40 UTC
mesos git commit: Removed unnecessary freeaddrinfo in getIP if
getaddrinfo returns error.
Repository: mesos
Updated Branches:
refs/heads/master 664788b94 -> bf9cb1256
Removed unnecessary freeaddrinfo in getIP if getaddrinfo returns error.
Review: https://reviews.apache.org/r/33329
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/bf9cb125
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/bf9cb125
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/bf9cb125
Branch: refs/heads/master
Commit: bf9cb125656f057ab8e86e556a1009ee349811bb
Parents: 664788b
Author: Chi Zhang <ch...@gmail.com>
Authored: Wed Apr 22 11:26:15 2015 -0700
Committer: Jie Yu <yu...@gmail.com>
Committed: Wed Apr 22 11:26:16 2015 -0700
----------------------------------------------------------------------
3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/bf9cb125/3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp
index 3622165..23d086b 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/net.hpp
@@ -193,13 +193,11 @@ inline Try<std::string> getHostname(const IP& ip)
// obtained.
inline Try<IP> getIP(const std::string& hostname, int family)
{
- struct addrinfo hints, *result;
+ struct addrinfo hints;
+ struct addrinfo* result = NULL;
hints = createAddrInfo(SOCK_STREAM, family, 0);
int error = getaddrinfo(hostname.c_str(), NULL, &hints, &result);
- if (error != 0 || result == NULL) {
- if (result != NULL ) {
- freeaddrinfo(result);
- }
+ if (error != 0) {
return Error(gai_strerror(error));
}
if (result->ai_addr == NULL) {