diff --git a/dll/win32/rpcrt4/rpcrt4_main.c b/dll/win32/rpcrt4/rpcrt4_main.c index 67a3dbe595f..7cc8d0b06b2 100644 --- a/dll/win32/rpcrt4/rpcrt4_main.c +++ b/dll/win32/rpcrt4/rpcrt4_main.c @@ -158,6 +158,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) RPC_STATUS WINAPI RpcStringFreeA(RPC_CSTR* String) { HeapFree( GetProcessHeap(), 0, *String); + if (String) *String = NULL; return RPC_S_OK; } @@ -174,6 +175,7 @@ RPC_STATUS WINAPI RpcStringFreeA(RPC_CSTR* String) RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR* String) { HeapFree( GetProcessHeap(), 0, *String); + if (String) *String = NULL; return RPC_S_OK; } diff --git a/modules/rostests/winetests/rpcrt4/rpc.c b/modules/rostests/winetests/rpcrt4/rpc.c index d3a3aee6c8c..dcf7a2d9608 100644 --- a/modules/rostests/winetests/rpcrt4/rpc.c +++ b/modules/rostests/winetests/rpcrt4/rpc.c @@ -854,6 +854,22 @@ static void test_RpcBindingFree(void) status); } +static void test_RpcStringFree(void) +{ + RPC_WSTR string = NULL; + + string = HeapAlloc(GetProcessHeap(), 0, 10*sizeof(WCHAR)); + if (string == NULL) + { + skip("Failed to allocate a string!\n"); + return; + } + + RpcStringFreeW(&string); + + ok(string == NULL, "String is %p expected NULL!\n", string); +} + static void test_RpcServerInqDefaultPrincName(void) { RPC_STATUS ret; @@ -1204,6 +1220,7 @@ START_TEST( rpc ) test_UuidCreate(); test_UuidCreateSequential(); test_RpcBindingFree(); + test_RpcStringFree(); test_RpcServerInqDefaultPrincName(); test_RpcServerRegisterAuthInfo();