Sven Baars : ws2_32: Use heap_realloc instead of HeapReAlloc to avoid an invalid realloc ( Valgrind).
Alexandre Julliard
julliard at winehq.org
Wed Feb 6 15:32:29 CST 2019
Module: wine
Branch: master
Commit: 651c446217ce41e3dfccec3d20c03986c1d2c708
URL: https://source.winehq.org/git/wine.git/?a=commit;h=651c446217ce41e3dfccec3d20c03986c1d2c708
Author: Sven Baars <sven.wine at gmail.com>
Date: Wed Feb 6 19:44:06 2019 +0100
ws2_32: Use heap_realloc instead of HeapReAlloc to avoid an invalid realloc (Valgrind).
Signed-off-by: Sven Baars <sven.wine at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ws2_32/socket.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 640726d..542dc9a 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -158,6 +158,7 @@
#include "wine/debug.h"
#include "wine/exception.h"
#include "wine/unicode.h"
+#include "wine/heap.h"
#if defined(linux) && !defined(IP_UNICAST_IF)
#define IP_UNICAST_IF 50
@@ -6272,8 +6273,7 @@ static struct WS_hostent* WS_get_local_ips( char *hostname )
return NULL;
adapters = HeapAlloc(GetProcessHeap(), 0, adap_size);
routes = HeapAlloc(GetProcessHeap(), 0, route_size);
- route_addrs = HeapAlloc(GetProcessHeap(), 0, 0); /* HeapReAlloc doesn't work on NULL */
- if (adapters == NULL || routes == NULL || route_addrs == NULL)
+ if (adapters == NULL || routes == NULL)
goto cleanup;
/* Obtain the adapter list and the full routing table */
if (GetAdaptersInfo(adapters, &adap_size) != NO_ERROR)
@@ -6306,7 +6306,7 @@ static struct WS_hostent* WS_get_local_ips( char *hostname )
}
if (exists)
continue;
- route_addrs = HeapReAlloc(GetProcessHeap(), 0, route_addrs, (numroutes+1)*sizeof(struct route));
+ route_addrs = heap_realloc(route_addrs, (numroutes+1)*sizeof(struct route));
if (route_addrs == NULL)
goto cleanup; /* Memory allocation error, fail gracefully */
route_addrs[numroutes].interface = ifindex;
More information about the wine-cvs
mailing list