[wsock32] Memleak fix in socket errorpath.
Peter Berg Larsen
pebl at math.ku.dk
Thu Mar 10 16:22:01 CST 2005
Changelog:
Assorted memleak fixes in wsock32/*.
Found on Michael Stefaniuc smatch list.
Index: dlls/wsock32/socket.c
===================================================================
RCS file: /home/wine/wine/dlls/wsock32/socket.c,v
retrieving revision 1.31
diff -u -r1.31 socket.c
--- dlls/wsock32/socket.c 2 Mar 2005 12:23:21 -0000 1.31
+++ dlls/wsock32/socket.c 10 Mar 2005 00:10:15 -0000
@@ -436,7 +436,7 @@
* interface are returned. */
case CL_NL_ENTITY:
{
- DWORD routeTableSize, numRoutes, ndx;
+ DWORD routeTableSize, numRoutes, ndx, ret;
PMIB_IPFORWARDTABLE table;
IPRouteEntry *winRouteTable = (IPRouteEntry *) pResponseInfo;
@@ -450,8 +450,12 @@
table = (PMIB_IPFORWARDTABLE)calloc(1, routeTableSize);
if (!table)
return ERROR_NOT_ENOUGH_MEMORY;
- GetIpForwardTable(table, &routeTableSize, FALSE);
-
+ ret = GetIpForwardTable(table, &routeTableSize, FALSE);
+ if (ret != NO_ERROR) {
+ free(table);
+ return ret;
+ }
+
memset(pResponseInfo, 0, sizeof(IPRouteEntry) * numRoutes);
for (ndx = 0; ndx < table->dwNumEntries; ndx++)
{
@@ -496,8 +500,10 @@
if (!table)
return ERROR_NOT_ENOUGH_MEMORY;
ret = GetIpNetTable(table, &arpTableSize, FALSE);
- if (ret != NO_ERROR)
+ if (ret != NO_ERROR) {
+ free(table);
return ret;
+ }
if (*pcbResponseInfoLen < sizeof(MIB_IPNETROW) *
table->dwNumEntries)
{
@@ -532,8 +538,10 @@
if (!table)
return ERROR_NOT_ENOUGH_MEMORY;
ret = GetTcpTable(table, &tcpTableSize, FALSE);
- if (ret != NO_ERROR)
+ if (ret != NO_ERROR) {
+ free(table);
return ret;
+ }
if (*pcbResponseInfoLen < sizeof(MIB_TCPROW) *
table->dwNumEntries)
{
More information about the wine-patches
mailing list