From c3e724d0479eda244bc118e1a0023decba9959ba Mon Sep 17 00:00:00 2001 From: Ove Kaaven Date: Fri, 31 Jan 2003 03:22:38 +0000 Subject: [PATCH] Fixed a bug in CompleteBindingA/W. --- dlls/rpcrt4/rpc_binding.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dlls/rpcrt4/rpc_binding.c b/dlls/rpcrt4/rpc_binding.c index 01a070f25c7..895299f04d7 100644 --- a/dlls/rpcrt4/rpc_binding.c +++ b/dlls/rpcrt4/rpc_binding.c @@ -137,35 +137,38 @@ RPC_STATUS RPCRT4_CompleteBindingA(RpcBinding* Binding, LPSTR NetworkAddr, LPST RPCRT4_strfree(Binding->NetworkAddr); Binding->NetworkAddr = RPCRT4_strdupA(NetworkAddr); RPCRT4_strfree(Binding->Endpoint); - if (Binding->Endpoint) { + if (Endpoint) { Binding->Endpoint = RPCRT4_strdupA(Endpoint); } else { Binding->Endpoint = RPCRT4_strdupA(""); } + if (!Binding->Endpoint) ERR("out of memory?\n"); return RPC_S_OK; } RPC_STATUS RPCRT4_CompleteBindingW(RpcBinding* Binding, LPWSTR NetworkAddr, LPWSTR Endpoint, LPWSTR NetworkOptions) { - TRACE("(RpcBinding == ^%p, NetworkAddr == \"%s\", EndPoint == \"%s\", NetworkOptions == \"%s\")\n", Binding, debugstr_w(NetworkAddr), debugstr_w(Endpoint), debugstr_w(NetworkOptions)); RPCRT4_strfree(Binding->NetworkAddr); Binding->NetworkAddr = RPCRT4_strdupWtoA(NetworkAddr); RPCRT4_strfree(Binding->Endpoint); - if (Binding->Endpoint) { + if (Endpoint) { Binding->Endpoint = RPCRT4_strdupWtoA(Endpoint); } else { Binding->Endpoint = RPCRT4_strdupA(""); } + if (!Binding->Endpoint) ERR("out of memory?\n"); return RPC_S_OK; } RPC_STATUS RPCRT4_ResolveBinding(RpcBinding* Binding, LPSTR Endpoint) { + TRACE("(RpcBinding == ^%p, EndPoint == \"%s\"\n", Binding, Endpoint); + RPCRT4_strfree(Binding->Endpoint); Binding->Endpoint = RPCRT4_strdupA(Endpoint);