mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 01:45:17 +00:00
esx: call freeaddrinfo earlier in esxUtil_ResolveHostname
Call freeaddrinfo() as soon as @result is not needed anymore, i.e. right after getnameinfo(); this avoids calling freeaddrinfo() in two branches. Signed-off-by: Pino Toscano <ptoscano@redhat.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
parent
0fa5c23865
commit
3aaf23ff69
@ -310,17 +310,15 @@ esxUtil_ResolveHostname(const char *hostname,
|
||||
|
||||
errcode = getnameinfo(result->ai_addr, result->ai_addrlen, ipAddress,
|
||||
ipAddress_length, NULL, 0, NI_NUMERICHOST);
|
||||
freeaddrinfo(result);
|
||||
|
||||
if (errcode != 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Formatting IP address for host '%s' failed: %s"), hostname,
|
||||
gai_strerror(errcode));
|
||||
freeaddrinfo(result);
|
||||
return -1;
|
||||
}
|
||||
|
||||
freeaddrinfo(result);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user