diff options
-rw-r--r-- | src/resolv/async_resolv.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/resolv/async_resolv.c b/src/resolv/async_resolv.c index f0361ce8c..38fa84d9f 100644 --- a/src/resolv/async_resolv.c +++ b/src/resolv/async_resolv.c @@ -1151,7 +1151,6 @@ resolv_is_address(const char *name) hints.ai_flags = AI_NUMERICHOST; /* No network lookups */ ret = getaddrinfo(name, NULL, &hints, &res); - freeaddrinfo(res); if (ret != 0) { if (ret == -2) { DEBUG(SSSDBG_TRACE_ALL, @@ -1160,6 +1159,8 @@ resolv_is_address(const char *name) DEBUG(SSSDBG_OP_FAILURE, "getaddrinfo failed [%d]: %s\n", ret, gai_strerror(ret)); } + } else { /* ret == 0 */ + freeaddrinfo(res); } return ret == 0; |