André Hentschel : shlwapi/tests: Don' t access memory when the allocation failed.

Alexandre Julliard julliard at winehq.org
Thu Jul 28 13:55:39 CDT 2011


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

Author: André Hentschel <nerv at dawncrow.de>
Date:   Wed Jul 27 20:40:50 2011 +0200

shlwapi/tests: Don't access memory when the allocation failed.

---

 dlls/shlwapi/tests/ordinal.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/shlwapi/tests/ordinal.c b/dlls/shlwapi/tests/ordinal.c
index bfda161..cde3378 100644
--- a/dlls/shlwapi/tests/ordinal.c
+++ b/dlls/shlwapi/tests/ordinal.c
@@ -2889,8 +2889,11 @@ static void test_SHGetShellKey(void)
     hres = pSKAllocValueW(SHKEY_Root_HKLM, WineTestW, NULL, NULL, (void**)&alloc_data, &size);
     ok(hres == S_OK, "hres= %x\n", hres);
     ok(size == sizeof(DWORD), "size = %d\n", size);
-    ok(*alloc_data == 1234, "*alloc_data = %d\n", *alloc_data);
-    LocalFree(alloc_data);
+    if (SUCCEEDED(hres))
+    {
+        ok(*alloc_data == 1234, "*alloc_data = %d\n", *alloc_data);
+        LocalFree(alloc_data);
+    }
 
     hres = pSKDeleteValueW(SHKEY_Root_HKLM, WineTestW, NULL);
     ok(hres == S_OK, "hres = %x\n", hres);




More information about the wine-cvs mailing list