ws2_32: Fix hostent memory allocation (try 3, resend)

Bruno Jesus 00cpxxx at
Sat Jun 9 12:34:59 CDT 2012

try 3, resend:
Rebased on top of latest wine.

try 3:
Avoid messing with the helper functions.

try 2:
Removed documentation from small functions.
Removed optional parameters from list_size.

Currently WS_create_he is used in 2 different places with incompatible
arguments. The first call assumes that the parameters are the number
of items (aliases/addresses) [1] the second call assumes the
parameters are the required amount of bytes to alloc [2]. The second
call is clearly wrong because WS_create_he multiply the parameters by
sizeof(char*) so the current approach allocates way more memory than
required when gethostbyname is called. This patch normalizes
WS_create_he making it more flexible and allowing the correct
allocation of memory. It also make list_dup and list_size more
flexible so they can be used in different ways allowing to get
separate amount of data and item count in list_size and allowing
list_dup to start copying items from a different point.

Fixes bug 3962.

[1] =
[2] =
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ws2_32-Fix-gethostbyname.patch
Type: application/octet-stream
Size: 6629 bytes
Desc: not available
URL: <>

More information about the wine-patches mailing list