[IPHLPAPI] Don't leak memory
authorPierre Schweitzer <pierre@reactos.org>
Sat, 24 Nov 2018 19:34:20 +0000 (20:34 +0100)
committerPierre Schweitzer <pierre@reactos.org>
Sat, 24 Nov 2018 20:41:09 +0000 (21:41 +0100)
dll/win32/iphlpapi/iphlpapi_main.c

index 2792be2..404c1b7 100644 (file)
@@ -876,6 +876,8 @@ DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, U
                         qsort(pTheirTcpTable->table, pTheirTcpTable->dwNumEntries,
                               sizeof(MIB_TCPROW), TcpTableSorter);
                 }
                         qsort(pTheirTcpTable->table, pTheirTcpTable->dwNumEntries,
                               sizeof(MIB_TCPROW), TcpTableSorter);
                 }
+
+                free(pOurTcpTable);
             }
         }
         break;
             }
         }
         break;
@@ -918,6 +920,8 @@ DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, U
                         qsort(pTheirTcpTable->table, pTheirTcpTable->dwNumEntries,
                               sizeof(MIB_TCPROW), TcpTableSorter);
                 }
                         qsort(pTheirTcpTable->table, pTheirTcpTable->dwNumEntries,
                               sizeof(MIB_TCPROW), TcpTableSorter);
                 }
+
+                free(pOurTcpTable);
             }
         }
         break;
             }
         }
         break;
@@ -943,6 +947,8 @@ DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, U
                         qsort(pTheirTcpTable->table, pTheirTcpTable->dwNumEntries,
                               sizeof(MIB_TCPROW_OWNER_PID), TcpTableSorter);
                 }
                         qsort(pTheirTcpTable->table, pTheirTcpTable->dwNumEntries,
                               sizeof(MIB_TCPROW_OWNER_PID), TcpTableSorter);
                 }
+
+                free(pOurTcpTable);
             }
         }
         break;
             }
         }
         break;
@@ -986,6 +992,8 @@ DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, U
                         qsort(pTheirTcpTable->table, pTheirTcpTable->dwNumEntries,
                               sizeof(MIB_TCPROW_OWNER_PID), TcpTableSorter);
                 }
                         qsort(pTheirTcpTable->table, pTheirTcpTable->dwNumEntries,
                               sizeof(MIB_TCPROW_OWNER_PID), TcpTableSorter);
                 }
+
+                free(pOurTcpTable);
             }
         }
         break;
             }
         }
         break;
@@ -1029,6 +1037,8 @@ DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, U
                         qsort(pTheirTcpTable->table, pTheirTcpTable->dwNumEntries,
                               sizeof(MIB_TCPROW_OWNER_PID), TcpTableSorter);
                 }
                         qsort(pTheirTcpTable->table, pTheirTcpTable->dwNumEntries,
                               sizeof(MIB_TCPROW_OWNER_PID), TcpTableSorter);
                 }
+
+                free(pOurTcpTable);
             }
         }
         break;
             }
         }
         break;