[PATCH] iphlpapi: Return early on error.

Huw Davies huw at codeweavers.com
Wed Aug 25 01:37:06 CDT 2021


This prevents using err uninitialized.  Spotted by Fabian Maurer.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51655
Signed-off-by: Huw Davies <huw at codeweavers.com>
---
Supersedes 212361.

 dlls/iphlpapi/iphlpapi_main.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c
index 47c8a507e38..f83271eae97 100644
--- a/dlls/iphlpapi/iphlpapi_main.c
+++ b/dlls/iphlpapi/iphlpapi_main.c
@@ -1206,15 +1206,11 @@ static DWORD dns_info_alloc( IP_ADAPTER_ADDRESSES *aa, ULONG family, ULONG flags
                 }
             }
             if (servers != (DNS_ADDR_ARRAY *)buf) heap_free( servers );
-            if (err) goto err;
+            if (err) return err;
         }
 
         aa->DnsSuffix = heap_alloc( MAX_DNS_SUFFIX_STRING_LENGTH * sizeof(WCHAR) );
-        if (!aa->DnsSuffix)
-        {
-            err = ERROR_NOT_ENOUGH_MEMORY;
-            goto err;
-        }
+        if (!aa->DnsSuffix) return ERROR_NOT_ENOUGH_MEMORY;
         aa->DnsSuffix[0] = '\0';
 
         if (!DnsQueryConfig( DnsConfigSearchList, 0, name, NULL, NULL, &size ) &&
@@ -1231,8 +1227,7 @@ static DWORD dns_info_alloc( IP_ADAPTER_ADDRESSES *aa, ULONG family, ULONG flags
         aa = aa->Next;
     }
 
-err:
-    return err;
+    return ERROR_SUCCESS;
 }
 
 static DWORD adapters_addresses_alloc( ULONG family, ULONG flags, IP_ADAPTER_ADDRESSES **info )
-- 
2.23.0




More information about the wine-devel mailing list