Skip to content
This repository was archived by the owner on Jul 9, 2023. It is now read-only.

Commit f2dbf77

Browse files
authored
Merge pull request #414 from antrv/feature/fix-getprocessid
Fix releasing memory in GetProcessIdByLocalPort
2 parents 89b4736 + 3ea7f56 commit f2dbf77

File tree

1 file changed

+2
-3
lines changed
  • Titanium.Web.Proxy/Helpers

1 file changed

+2
-3
lines changed

Titanium.Web.Proxy/Helpers/Tcp.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@ internal static unsafe int GetProcessIdByLocalPort(IpVersion ipVersion, int loca
3737
0) == 0)
3838
{
3939
int rowCount = *(int*)tcpTable;
40-
tcpTable += 4; // int size
4140

4241
if (ipVersion == IpVersion.Ipv4)
4342
{
44-
NativeMethods.TcpRow* rowPtr = (NativeMethods.TcpRow*)tcpTable;
43+
NativeMethods.TcpRow* rowPtr = (NativeMethods.TcpRow*)(tcpTable + 4);
4544

4645
for (int i = 0; i < rowCount; ++i)
4746
{
@@ -55,7 +54,7 @@ internal static unsafe int GetProcessIdByLocalPort(IpVersion ipVersion, int loca
5554
}
5655
else
5756
{
58-
NativeMethods.Tcp6Row* rowPtr = (NativeMethods.Tcp6Row*)tcpTable;
57+
NativeMethods.Tcp6Row* rowPtr = (NativeMethods.Tcp6Row*)(tcpTable + 4);
5958

6059
for (int i = 0; i < rowCount; ++i)
6160
{

0 commit comments

Comments
 (0)