From bffd21ad8047601e56d229e619bbcdb76096d975 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 1 Mar 2019 21:05:23 +0100 Subject: [PATCH] Cygwin: load_user_profile: use local pointer when appropriate dnsdomain does not have to be a copy of the domain, a pointer into cygheap is sufficient. Signed-off-by: Corinna Vinschen --- winsup/cygwin/sec_auth.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/sec_auth.cc b/winsup/cygwin/sec_auth.cc index 077b37ced..ee740facc 100644 --- a/winsup/cygwin/sec_auth.cc +++ b/winsup/cygwin/sec_auth.cc @@ -278,11 +278,11 @@ load_user_profile (HANDLE token, struct passwd *pw, cygpsid &usersid) else { cyg_ldap cldap; - PWCHAR dnsdomain = NULL; + PCWSTR dnsdomain = NULL; debug_printf ("primary domain <%W>", cygheap->dom.primary_flat_name ()); if (!wcscasecmp (domain, cygheap->dom.primary_flat_name ())) - dnsdomain = wcsdup (cygheap->dom.primary_dns_name ()); + dnsdomain = cygheap->dom.primary_dns_name (); else { PDS_DOMAIN_TRUSTSW td = NULL; @@ -292,7 +292,7 @@ load_user_profile (HANDLE token, struct passwd *pw, cygpsid &usersid) debug_printf ("foreign domain <%W>", td->NetbiosDomainName); if (!wcscasecmp (domain, td->NetbiosDomainName)) { - dnsdomain = wcsdup (td->DnsDomainName); + dnsdomain = td->DnsDomainName; break; } } @@ -309,7 +309,6 @@ load_user_profile (HANDLE token, struct passwd *pw, cygpsid &usersid) pi.lpProfilePath = userpath; } } - free (dnsdomain); } else debug_printf ("Unknown domain <%W>?", domain);