Alex Henrie : ws2_32: Fix memory leaks on error paths in unix_gethostby* (scan-build).

Alexandre Julliard julliard at winehq.org
Wed Feb 2 16:38:04 CST 2022


Module: wine
Branch: master
Commit: 6daef74f67690372e7bde377dffa0db63b25d9f8
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6daef74f67690372e7bde377dffa0db63b25d9f8

Author: Alex Henrie <alexhenrie24 at gmail.com>
Date:   Wed Feb  2 00:23:19 2022 -0700

ws2_32: Fix memory leaks on error paths in unix_gethostby* (scan-build).

Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ws2_32/unixlib.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/dlls/ws2_32/unixlib.c b/dlls/ws2_32/unixlib.c
index 56a0bed308d..0625c5c72ce 100644
--- a/dlls/ws2_32/unixlib.c
+++ b/dlls/ws2_32/unixlib.c
@@ -865,9 +865,9 @@ static NTSTATUS unix_gethostbyaddr( void *args )
         }
 
         if (!unix_host)
-            return (locerr < 0 ? errno_from_unix( errno ) : host_errno_from_unix( locerr ));
-
-        ret = hostent_from_unix( unix_host, params->host, params->size );
+            ret = (locerr < 0 ? errno_from_unix( errno ) : host_errno_from_unix( locerr ));
+        else
+            ret = hostent_from_unix( unix_host, params->host, params->size );
 
         free( unix_buffer );
         return ret;
@@ -915,9 +915,9 @@ static NTSTATUS unix_gethostbyname( void *args )
     }
 
     if (!unix_host)
-        return (locerr < 0 ? errno_from_unix( errno ) : host_errno_from_unix( locerr ));
-
-    ret = hostent_from_unix( unix_host, params->host, params->size );
+        ret = (locerr < 0 ? errno_from_unix( errno ) : host_errno_from_unix( locerr ));
+    else
+        ret = hostent_from_unix( unix_host, params->host, params->size );
 
     free( unix_buffer );
     return ret;




More information about the wine-cvs mailing list