shlwapi/tests: Don't access memory when the allocation failed
André Hentschel
nerv at dawncrow.de
Wed Jul 27 13:40:50 CDT 2011
might fix
http://test.winehq.org/data/093547e1581e50da44d62d9a60e305a8a0bf2fc1/win7_fg-win7u64fr-t32/shlwapi:ordinal.html
but i think it's a good idea anyway.
---
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);
--
Best Regards, André Hentschel
More information about the wine-patches
mailing list