From: Alex Henrie <alexhenrie24(a)gmail.com> If the canonical hostname was "localhost", the address info was not freed. Also, since we're touching the same line that defines the address info hints, make the hints `static const` so that the compiler knows it's safe to put them in read-only memory if it wants. Fixes: ca5a6d07dc92ba631b178ec175e6b3fd5295e3d6 --- programs/wineboot/wineboot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c index 8359e5d4c44..94ef024e32a 100644 --- a/programs/wineboot/wineboot.c +++ b/programs/wineboot/wineboot.c @@ -827,12 +827,12 @@ static void create_dynamic_registry_keys(void) /* create the ComputerName registry keys */ static void create_computer_name_keys(void) { - struct addrinfo hints = {0}, *res; + static const struct addrinfo hints = { .ai_flags = AI_CANONNAME }; + struct addrinfo *res = NULL; char *dot, buffer[256], *name = buffer; HKEY key, subkey; if (gethostname( buffer, sizeof(buffer) )) return; - hints.ai_flags = AI_CANONNAME; if (!getaddrinfo( buffer, NULL, &hints, &res ) && res->ai_canonname && strcasecmp(res->ai_canonname, "localhost") != 0) name = res->ai_canonname; @@ -841,7 +841,7 @@ static void create_computer_name_keys(void) else dot = name + strlen(name); SetComputerNameExA( ComputerNamePhysicalDnsDomain, dot ); SetComputerNameExA( ComputerNamePhysicalDnsHostname, name ); - if (name != buffer) freeaddrinfo( res ); + if (res) freeaddrinfo( res ); if (RegOpenKeyW( HKEY_LOCAL_MACHINE, L"System\\CurrentControlSet\\Control\\ComputerName", &key )) return; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/8918