Huw Davies : ntdll: Free the correct buffer in the test.

Alexandre Julliard julliard at winehq.org
Fri Jun 20 06:21:42 CDT 2008


Module: wine
Branch: master
Commit: a3d715594735313b8fe51e5f7d462b26c311af76
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a3d715594735313b8fe51e5f7d462b26c311af76

Author: Huw Davies <huw at codeweavers.com>
Date:   Thu Jun 19 12:46:55 2008 +0100

ntdll: Free the correct buffer in the test.

---

 dlls/ntdll/tests/info.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
index 140be05..8e1e836 100644
--- a/dlls/ntdll/tests/info.c
+++ b/dlls/ntdll/tests/info.c
@@ -243,20 +243,20 @@ static void test_query_process(void)
     } SYSTEM_PROCESS_INFORMATION_PRIVATE, *PSYSTEM_PROCESS_INFORMATION_PRIVATE;
 
     ULONG SystemInformationLength = sizeof(SYSTEM_PROCESS_INFORMATION_PRIVATE);
-    SYSTEM_PROCESS_INFORMATION_PRIVATE* spi = HeapAlloc(GetProcessHeap(), 0, SystemInformationLength);
+    SYSTEM_PROCESS_INFORMATION_PRIVATE *spi, *spi_buf = HeapAlloc(GetProcessHeap(), 0, SystemInformationLength);
 
     /* Only W2K3 returns the needed length, the rest returns 0, so we have to loop */
 
     for (;;)
     {
-        status = pNtQuerySystemInformation(SystemProcessInformation, spi, SystemInformationLength, &ReturnLength);
+        status = pNtQuerySystemInformation(SystemProcessInformation, spi_buf, SystemInformationLength, &ReturnLength);
 
         if (status != STATUS_INFO_LENGTH_MISMATCH) break;
         
-        spi = HeapReAlloc(GetProcessHeap(), 0, spi , SystemInformationLength *= 2);
+        spi_buf = HeapReAlloc(GetProcessHeap(), 0, spi_buf , SystemInformationLength *= 2);
     }
-
     ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
+    spi = spi_buf;
 
     /* Get the first dwOffset, from this we can deduce the OS version we're running
      *
@@ -320,7 +320,7 @@ static void test_query_process(void)
 
     if (one_before_last_pid == 0) one_before_last_pid = last_pid;
 
-    HeapFree( GetProcessHeap(), 0, spi);
+    HeapFree( GetProcessHeap(), 0, spi_buf);
 }
 
 static void test_query_procperf(void)




More information about the wine-cvs mailing list