Module: wine Branch: stable Commit: 8858479b5c4673540ca6ff4317f56c3a3e0e999f URL: https://gitlab.winehq.org/wine/wine/-/commit/8858479b5c4673540ca6ff4317f56c3... Author: Alex Henrie <alexhenrie24(a)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(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> (cherry picked from commit 6daef74f67690372e7bde377dffa0db63b25d9f8) Signed-off-by: Michael Stefaniuc <mstefani(a)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;