https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f540b2b20ca5f35ce2678bbfa05c120a21fd5f4b

commit f540b2b20ca5f35ce2678bbfa05c120a21fd5f4b
Author:     Serge Gautherie <[email protected]>
AuthorDate: Wed Apr 15 13:05:54 2020 +0200
Commit:     GitHub <[email protected]>
CommitDate: Wed Apr 15 13:05:54 2020 +0200

    [IPHLPAPI] GetAdaptersAddresses(): Add 1 free() in ERROR_NO_DATA case 
(#2526)
    
    And fix 4 comments.
    Follow-up to 68d94581.
---
 dll/win32/iphlpapi/iphlpapi_main.c | 3 +++
 dll/win32/iphlpapi/ipstats.h       | 8 ++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/dll/win32/iphlpapi/iphlpapi_main.c 
b/dll/win32/iphlpapi/iphlpapi_main.c
index a9184b2739d..7e0b0c9cc86 100644
--- a/dll/win32/iphlpapi/iphlpapi_main.c
+++ b/dll/win32/iphlpapi/iphlpapi_main.c
@@ -3186,7 +3186,10 @@ DWORD WINAPI DECLSPEC_HOTPATCH 
GetAdaptersAddresses(ULONG Family,ULONG Flags,PVO
 
     ret = openTcpFile(&tcpFile, FILE_READ_DATA);
     if (!NT_SUCCESS(ret))
+    {
+        free(indexTable);
         return ERROR_NO_DATA;
+    }
 
     for (i = indexTable->numIndexes; i >= 0; i--)
     {
diff --git a/dll/win32/iphlpapi/ipstats.h b/dll/win32/iphlpapi/ipstats.h
index 66d78c946f2..aa9283eb5dd 100644
--- a/dll/win32/iphlpapi/ipstats.h
+++ b/dll/win32/iphlpapi/ipstats.h
@@ -83,7 +83,7 @@ typedef enum _CLASS_TABLE {
 } CLASS_TABLE;
 
 /* Allocates and returns to you the route table, or NULL if it can't allocate
- * enough memory.  free() the returned table.
+ * enough memory.  HeapFree() the returned table.
  */
 RouteTable *getRouteTable(void);
 
@@ -91,7 +91,7 @@ RouteTable *getRouteTable(void);
 DWORD getNumArpEntries(void);
 
 /* Allocates and returns to you the arp table, or NULL if it can't allocate
- * enough memory.  free() the returned table.
+ * enough memory.  HeapFree() the returned table.
  */
 PMIB_IPNETTABLE getArpTable(void);
 
@@ -99,7 +99,7 @@ PMIB_IPNETTABLE getArpTable(void);
 DWORD getNumUdpEntries(void);
 
 /* Allocates and returns to you the UDP state table, or NULL if it can't
- * allocate enough memory.  free() the returned table.
+ * allocate enough memory.  HeapFree() the returned table.
  */
 PVOID getUdpTable(CLASS_TABLE Class);
 
@@ -107,7 +107,7 @@ PVOID getUdpTable(CLASS_TABLE Class);
 DWORD getNumTcpEntries(void);
 
 /* Allocates and returns to you the TCP state table, or NULL if it can't
- * allocate enough memory.  free() the returned table.
+ * allocate enough memory.  HeapFree() the returned table.
  */
 PVOID getTcpTable(CLASS_TABLE Class);
 

Reply via email to