[PATCH resend] ws2_32: Fix memory leaks on error paths in unix_gethostby* (scan-build)

Alex Henrie alexhenrie24 at gmail.com
Wed Feb 2 01:23:19 CST 2022


Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
 dlls/ws2_32/unixlib.c | 6 ++++++
 1 file changed, 6 insertions(+)

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




More information about the wine-devel mailing list