[PATCH 2/2] iphlpapi: Don't request redundant static data in get_extended_tcp_table().
Paul Gofman
pgofman at codeweavers.com
Tue Mar 22 13:54:50 CDT 2022
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
---
dlls/iphlpapi/iphlpapi_main.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c
index 041e712f44f..8e492601647 100644
--- a/dlls/iphlpapi/iphlpapi_main.c
+++ b/dlls/iphlpapi/iphlpapi_main.c
@@ -3093,13 +3093,20 @@ static DWORD get_extended_tcp_table( void *table, DWORD *size, BOOL sort, ULONG
DWORD err, count, needed, i, num = 0, row_size = 0;
struct nsi_tcp_conn_key *key;
struct nsi_tcp_conn_dynamic *dyn;
- struct nsi_tcp_conn_static *stat;
+ struct nsi_tcp_conn_static *stat = NULL;
if (!size) return ERROR_INVALID_PARAMETER;
- err = NsiAllocateAndGetTable( 1, &NPI_MS_TCP_MODULEID, tcp_table_id( table_class ), (void **)&key, sizeof(*key),
- NULL, 0, (void **)&dyn, sizeof(*dyn),
- (void **)&stat, sizeof(*stat), &count, 0 );
+
+ if (table_class >= TCP_TABLE_OWNER_PID_LISTENER)
+ err = NsiAllocateAndGetTable( 1, &NPI_MS_TCP_MODULEID, tcp_table_id( table_class ), (void **)&key, sizeof(*key),
+ NULL, 0, (void **)&dyn, sizeof(*dyn),
+ (void **)&stat, sizeof(*stat), &count, 0 );
+ else
+ err = NsiAllocateAndGetTable( 1, &NPI_MS_TCP_MODULEID, tcp_table_id( table_class ), (void **)&key, sizeof(*key),
+ NULL, 0, (void **)&dyn, sizeof(*dyn),
+ NULL, 0, &count, 0 );
+
if (err) return err;
for (i = 0; i < count; i++)
--
2.35.1
More information about the wine-devel
mailing list