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
7e584b43
Commit
7e584b43
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 if the UDP table is empty.
parent
72a59de2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
iphlpapi_main.c
dlls/iphlpapi/iphlpapi_main.c
+6
-3
ipstats.c
dlls/iphlpapi/ipstats.c
+5
-2
No files found.
dlls/iphlpapi/iphlpapi_main.c
View file @
7e584b43
...
...
@@ -1665,8 +1665,10 @@ DWORD WINAPI GetUdpTable(PMIB_UDPTABLE pUdpTable, PDWORD pdwSize, BOOL bOrder)
ret
=
ERROR_INVALID_PARAMETER
;
else
{
DWORD
numEntries
=
getNumUdpEntries
();
DWORD
size
=
sizeof
(
MIB_UDPTABLE
)
+
(
numEntries
-
1
)
*
sizeof
(
MIB_UDPROW
)
;
DWORD
size
=
sizeof
(
MIB_UDPTABLE
);
if
(
numEntries
>
1
)
size
+=
(
numEntries
-
1
)
*
sizeof
(
MIB_UDPROW
);
if
(
!
pUdpTable
||
*
pdwSize
<
size
)
{
*
pdwSize
=
size
;
ret
=
ERROR_INSUFFICIENT_BUFFER
;
...
...
@@ -1676,8 +1678,9 @@ DWORD WINAPI GetUdpTable(PMIB_UDPTABLE pUdpTable, PDWORD pdwSize, BOOL bOrder)
ret
=
getUdpTable
(
&
table
,
GetProcessHeap
(),
0
);
if
(
!
ret
)
{
size
=
sizeof
(
MIB_UDPTABLE
)
+
(
table
->
dwNumEntries
-
1
)
*
sizeof
(
MIB_UDPROW
);
size
=
sizeof
(
MIB_UDPTABLE
);
if
(
table
->
dwNumEntries
>
1
)
size
+=
(
table
->
dwNumEntries
-
1
)
*
sizeof
(
MIB_UDPROW
);
if
(
*
pdwSize
<
size
)
{
*
pdwSize
=
size
;
ret
=
ERROR_INSUFFICIENT_BUFFER
;
...
...
dlls/iphlpapi/ipstats.c
View file @
7e584b43
...
...
@@ -1112,9 +1112,12 @@ DWORD getUdpTable(PMIB_UDPTABLE *ppUdpTable, HANDLE heap, DWORD flags)
ret
=
ERROR_INVALID_PARAMETER
;
else
{
DWORD
numEntries
=
getNumUdpEntries
();
PMIB_UDPTABLE
table
=
HeapAlloc
(
heap
,
flags
,
sizeof
(
MIB_UDPTABLE
)
+
(
numEntries
-
1
)
*
sizeof
(
MIB_UDPROW
))
;
DWORD
size
=
sizeof
(
MIB_UDPTABLE
);
PMIB_UDPTABLE
table
;
if
(
numEntries
>
1
)
size
+=
(
numEntries
-
1
)
*
sizeof
(
MIB_UDPROW
);
table
=
HeapAlloc
(
heap
,
flags
,
size
);
if
(
table
)
{
FILE
*
fp
;
...
...
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