ws2_32: Fix hostent memory allocation (try 2)

Bruno Jesus 00cpxxx at gmail.com
Tue Apr 24 22:14:53 CDT 2012


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-allocation.patch
Type: application/octet-stream
Size: 9505 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20120425/d796be42/attachment-0001.obj>


More information about the wine-patches mailing list