Correct connection releases on error path in RPCRT4_OpenBinding.

oldstable
Mike Hearn 2004-06-16 20:07:19 +00:00 committed by Alexandre Julliard
parent d3278b6f41
commit c71c514fec
1 changed files with 4 additions and 2 deletions

View File

@ -514,6 +514,8 @@ RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection,
if (!Binding->server && Binding->FromConn &&
memcmp(&Binding->FromConn->ActiveInterface, InterfaceId,
sizeof(RPC_SYNTAX_IDENTIFIER))) {
TRACE("releasing pre-existing connection\n");
RPCRT4_ReleaseConnection(Binding->FromConn);
Binding->FromConn = NULL;
} else {
@ -577,13 +579,13 @@ RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection,
response_hdr->common.rpc_ver_minor != RPC_VER_MINOR ||
response_hdr->common.ptype != PKT_BIND_ACK) {
WARN("invalid protocol version or rejection packet\n");
RPCRT4_ReleaseConnection(Binding->FromConn);
RPCRT4_ReleaseConnection(*Connection);
return RPC_S_PROTOCOL_ERROR;
}
if (response_hdr->bind_ack.max_tsize < RPC_MIN_PACKET_SIZE) {
WARN("server doesn't allow large enough packets\n");
RPCRT4_ReleaseConnection(Binding->FromConn);
RPCRT4_ReleaseConnection(*Connection);
return RPC_S_PROTOCOL_ERROR;
}