[RPCRT4] RpcStringFreeA/W must set the pointer to NULL

Add a matching wine test.

This change will be sent upstream.
This commit is contained in:
Eric Kohl 2022-12-19 09:18:22 +01:00
parent 5ecb9e8cb5
commit 2a783979ff
2 changed files with 19 additions and 0 deletions

View file

@ -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;
}

View file

@ -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();