rpcrt4: Don't crash with a NULL binding handle in RpcBindingFree.

This commit is contained in:
Rob Shearman 2009-11-16 14:40:26 +00:00 committed by Alexandre Julliard
parent b49512ecaf
commit cdc10a8d3b
2 changed files with 17 additions and 2 deletions

View File

@ -785,8 +785,11 @@ RPC_STATUS WINAPI RpcBindingFree( RPC_BINDING_HANDLE* Binding )
{
RPC_STATUS status;
TRACE("(%p) = %p\n", Binding, *Binding);
status = RPCRT4_ReleaseBinding(*Binding);
if (status == RPC_S_OK) *Binding = 0;
if (*Binding)
status = RPCRT4_ReleaseBinding(*Binding);
else
status = RPC_S_INVALID_BINDING;
if (status == RPC_S_OK) *Binding = NULL;
return status;
}

View File

@ -800,6 +800,17 @@ static void test_UuidCreate(void)
}
}
static void test_RpcBindingFree(void)
{
RPC_BINDING_HANDLE binding = NULL;
RPC_STATUS status;
status = RpcBindingFree(&binding);
ok(status == RPC_S_INVALID_BINDING,
"RpcBindingFree should have retured RPC_S_INVALID_BINDING instead of %d\n",
status);
}
START_TEST( rpc )
{
UuidConversionAndComparison();
@ -811,4 +822,5 @@ START_TEST( rpc )
test_I_RpcExceptionFilter();
test_RpcStringBindingFromBinding();
test_UuidCreate();
test_RpcBindingFree();
}