Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
848e8de5
Commit
848e8de5
authored
Nov 15, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Nov 16, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iphlpapi: Don't allocate gobs of memory when the route table is empty.
parent
5349c5e8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
iphlpapi_main.c
dlls/iphlpapi/iphlpapi_main.c
+6
-4
ipstats.c
dlls/iphlpapi/ipstats.c
+5
-2
No files found.
dlls/iphlpapi/iphlpapi_main.c
View file @
848e8de5
...
...
@@ -1222,9 +1222,10 @@ DWORD WINAPI GetIpForwardTable(PMIB_IPFORWARDTABLE pIpForwardTable, PULONG pdwSi
ret
=
ERROR_INVALID_PARAMETER
;
else
{
DWORD
numRoutes
=
getNumRoutes
();
ULONG
sizeNeeded
=
sizeof
(
MIB_IPFORWARDTABLE
)
+
(
numRoutes
-
1
)
*
sizeof
(
MIB_IPFORWARDROW
);
ULONG
sizeNeeded
=
sizeof
(
MIB_IPFORWARDTABLE
);
if
(
numRoutes
>
1
)
sizeNeeded
+=
(
numRoutes
-
1
)
*
sizeof
(
MIB_IPFORWARDROW
);
if
(
!
pIpForwardTable
||
*
pdwSize
<
sizeNeeded
)
{
*
pdwSize
=
sizeNeeded
;
ret
=
ERROR_INSUFFICIENT_BUFFER
;
...
...
@@ -1234,8 +1235,9 @@ DWORD WINAPI GetIpForwardTable(PMIB_IPFORWARDTABLE pIpForwardTable, PULONG pdwSi
ret
=
getRouteTable
(
&
table
,
GetProcessHeap
(),
0
);
if
(
!
ret
)
{
sizeNeeded
=
sizeof
(
MIB_IPFORWARDTABLE
)
+
(
table
->
dwNumEntries
-
1
)
*
sizeof
(
MIB_IPFORWARDROW
);
sizeNeeded
=
sizeof
(
MIB_IPFORWARDTABLE
);
if
(
table
->
dwNumEntries
>
1
)
sizeNeeded
+=
(
table
->
dwNumEntries
-
1
)
*
sizeof
(
MIB_IPFORWARDROW
);
if
(
*
pdwSize
<
sizeNeeded
)
{
*
pdwSize
=
sizeNeeded
;
ret
=
ERROR_INSUFFICIENT_BUFFER
;
...
...
dlls/iphlpapi/ipstats.c
View file @
848e8de5
...
...
@@ -777,9 +777,12 @@ DWORD getRouteTable(PMIB_IPFORWARDTABLE *ppIpForwardTable, HANDLE heap,
ret
=
ERROR_INVALID_PARAMETER
;
else
{
DWORD
numRoutes
=
getNumRoutes
();
PMIB_IPFORWARDTABLE
table
=
HeapAlloc
(
heap
,
flags
,
sizeof
(
MIB_IPFORWARDTABLE
)
+
(
numRoutes
-
1
)
*
sizeof
(
MIB_IPFORWARDROW
))
;
DWORD
size
=
sizeof
(
MIB_IPFORWARDTABLE
);
PMIB_IPFORWARDTABLE
table
;
if
(
numRoutes
>
1
)
size
+=
(
numRoutes
-
1
)
*
sizeof
(
MIB_IPFORWARDROW
);
table
=
HeapAlloc
(
heap
,
flags
,
size
);
if
(
table
)
{
#if defined(HAVE_SYS_SYSCTL_H) && defined(NET_RT_DUMP)
int
mib
[
6
]
=
{
CTL_NET
,
PF_ROUTE
,
0
,
PF_INET
,
NET_RT_DUMP
,
0
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment