rpcrt4: Fix some memory leaks.
This commit is contained in:
parent
98facf4d0f
commit
b36d5fa11f
|
@ -446,6 +446,7 @@ RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection,
|
|||
InterfaceId, TransferSyntax);
|
||||
|
||||
status = RPCRT4_Send(*Connection, hdr, NULL, 0);
|
||||
RPCRT4_FreeHeader(hdr);
|
||||
if (status != RPC_S_OK) {
|
||||
RPCRT4_DestroyConnection(*Connection);
|
||||
return status;
|
||||
|
@ -461,6 +462,7 @@ RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection,
|
|||
count = rpcrt4_conn_read(NewConnection, response, RPC_MAX_PACKET_SIZE);
|
||||
if (count < sizeof(response_hdr->common)) {
|
||||
WARN("received invalid header\n");
|
||||
HeapFree(GetProcessHeap(), 0, response);
|
||||
RPCRT4_DestroyConnection(*Connection);
|
||||
return RPC_S_PROTOCOL_ERROR;
|
||||
}
|
||||
|
@ -471,12 +473,14 @@ 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");
|
||||
HeapFree(GetProcessHeap(), 0, response);
|
||||
RPCRT4_DestroyConnection(*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");
|
||||
HeapFree(GetProcessHeap(), 0, response);
|
||||
RPCRT4_DestroyConnection(*Connection);
|
||||
return RPC_S_PROTOCOL_ERROR;
|
||||
}
|
||||
|
@ -485,6 +489,7 @@ RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection,
|
|||
|
||||
(*Connection)->MaxTransmissionSize = response_hdr->bind_ack.max_tsize;
|
||||
(*Connection)->ActiveInterface = *InterfaceId;
|
||||
HeapFree(GetProcessHeap(), 0, response);
|
||||
}
|
||||
|
||||
return RPC_S_OK;
|
||||
|
|
|
@ -261,7 +261,9 @@ static void RPCRT4_process_packet(RpcConnection* conn, RpcPktHdr* hdr, RPC_MESSA
|
|||
conn->MaxTransmissionSize = hdr->bind.max_tsize;
|
||||
}
|
||||
|
||||
if (RPCRT4_Send(conn, response, NULL, 0) != RPC_S_OK)
|
||||
status = RPCRT4_Send(conn, response, NULL, 0);
|
||||
RPCRT4_FreeHeader(response);
|
||||
if (status != RPC_S_OK)
|
||||
goto fail;
|
||||
|
||||
break;
|
||||
|
@ -275,6 +277,7 @@ static void RPCRT4_process_packet(RpcConnection* conn, RpcPktHdr* hdr, RPC_MESSA
|
|||
status);
|
||||
|
||||
RPCRT4_Send(conn, response, NULL, 0);
|
||||
RPCRT4_FreeHeader(response);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -342,6 +345,7 @@ fail:
|
|||
msg->Buffer = NULL;
|
||||
RPCRT4_FreeHeader(hdr);
|
||||
TlsSetValue(worker_tls, NULL);
|
||||
HeapFree(GetProcessHeap(), 0, msg);
|
||||
}
|
||||
|
||||
static DWORD CALLBACK RPCRT4_worker_thread(LPVOID the_arg)
|
||||
|
@ -414,6 +418,7 @@ static DWORD CALLBACK RPCRT4_io_thread(LPVOID the_arg)
|
|||
status = RPCRT4_Receive(conn, &hdr, msg);
|
||||
if (status != RPC_S_OK) {
|
||||
WARN("receive failed with error %lx\n", status);
|
||||
HeapFree(GetProcessHeap(), 0, msg);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -430,7 +435,6 @@ static DWORD CALLBACK RPCRT4_io_thread(LPVOID the_arg)
|
|||
#endif
|
||||
msg = NULL;
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, msg);
|
||||
RPCRT4_DestroyConnection(conn);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1001,6 +1005,8 @@ RPC_STATUS WINAPI RpcMgmtWaitServerListen( void )
|
|||
|
||||
LeaveCriticalSection(&listen_cs);
|
||||
|
||||
FIXME("not waiting for server calls to finish\n");
|
||||
|
||||
return RPC_S_OK;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue