ws2_32: Fix hostent memory allocation (try 3)

Bruno Jesus 00cpxxx at gmail.com
Tue May 1 22:35:00 CDT 2012


try 3:
Avoid messing with the helper functions.

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

original:
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] = http://source.winehq.org/source/dlls/ws2_32/socket.c#L4559
[2] = http://source.winehq.org/source/dlls/ws2_32/socket.c#L5644
-------------- 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: <http://www.winehq.org/pipermail/wine-patches/attachments/20120502/c2bd35e5/attachment-0001.obj>


More information about the wine-patches mailing list