[PATCH] ws2_32: Fix memory leaks on error paths in unix_gethostby* (scan-build)
Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com> --- dlls/ws2_32/unixlib.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/ws2_32/unixlib.c b/dlls/ws2_32/unixlib.c index e89ebe35248..45018199add 100644 --- a/dlls/ws2_32/unixlib.c +++ b/dlls/ws2_32/unixlib.c @@ -865,12 +865,13 @@ static NTSTATUS unix_gethostbyaddr( void *args ) unix_buffer = new_buffer; } + free( unix_buffer ); + 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 ); - free( unix_buffer ); return ret; } #else @@ -915,12 +916,13 @@ static NTSTATUS unix_gethostbyname( void *args ) unix_buffer = new_buffer; } + free( unix_buffer ); + 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 ); - free( unix_buffer ); return ret; } #else -- 2.34.1
Hi, While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=104309 Your paranoid android. === debian11 (32 bit report) === ws2_32: protocol.c:2506: Test failed: gethostbyname("localhost") returned 4294967288.120.4294967277.125 === debian11 (32 bit Chinese:China report) === ws2_32: protocol.c:2506: Test failed: gethostbyname("localhost") returned 4294967192.4294967283.4294967244.125 === debian11 (32 bit WoW report) === ws2_32: protocol.c:2506: Test failed: gethostbyname("localhost") returned 56.92.89.126 === debian11 (64 bit WoW report) === ws2_32: protocol.c:2506: Test failed: gethostbyname("localhost") returned 4294967248.76.4294967199.126
participants (2)
-
Alex Henrie -
Marvin