mirror of https://github.com/FreeRDP/FreeRDP
Fixed memory leaks.
This commit is contained in:
parent
07051fb3d1
commit
585d9101b7
|
@ -357,7 +357,7 @@ int rpc_in_write(rdpRpc* rpc, const BYTE* data, int length)
|
|||
|
||||
int rpc_write(rdpRpc* rpc, BYTE* data, int length, UINT16 opnum)
|
||||
{
|
||||
BYTE* buffer;
|
||||
BYTE* buffer = NULL;
|
||||
UINT32 offset;
|
||||
rdpNtlm* ntlm;
|
||||
UINT32 stub_data_pad;
|
||||
|
@ -365,7 +365,7 @@ int rpc_write(rdpRpc* rpc, BYTE* data, int length, UINT16 opnum)
|
|||
SecBufferDesc Message;
|
||||
RpcClientCall* clientCall;
|
||||
SECURITY_STATUS encrypt_status;
|
||||
rpcconn_request_hdr_t* request_pdu;
|
||||
rpcconn_request_hdr_t* request_pdu = NULL;
|
||||
ntlm = rpc->ntlm;
|
||||
|
||||
if (!ntlm || !ntlm->table)
|
||||
|
@ -437,7 +437,9 @@ int rpc_write(rdpRpc* rpc, BYTE* data, int length, UINT16 opnum)
|
|||
Buffers[1].pvBuffer = calloc(1, Buffers[1].cbBuffer);
|
||||
|
||||
if (!Buffers[1].pvBuffer)
|
||||
return -1;
|
||||
{
|
||||
goto out_free_pdu;
|
||||
}
|
||||
|
||||
Message.cBuffers = 2;
|
||||
Message.ulVersion = SECBUFFER_VERSION;
|
||||
|
@ -447,8 +449,7 @@ int rpc_write(rdpRpc* rpc, BYTE* data, int length, UINT16 opnum)
|
|||
if (encrypt_status != SEC_E_OK)
|
||||
{
|
||||
WLog_ERR(TAG, "EncryptMessage status: 0x%08X", encrypt_status);
|
||||
free(request_pdu);
|
||||
return -1;
|
||||
goto out_free_pdu;
|
||||
}
|
||||
|
||||
CopyMemory(&buffer[offset], Buffers[1].pvBuffer, Buffers[1].cbBuffer);
|
||||
|
@ -458,12 +459,19 @@ int rpc_write(rdpRpc* rpc, BYTE* data, int length, UINT16 opnum)
|
|||
if (rpc_send_enqueue_pdu(rpc, buffer, request_pdu->frag_length) < 0)
|
||||
length = -1;
|
||||
|
||||
free (buffer);
|
||||
free(request_pdu);
|
||||
return length;
|
||||
|
||||
out_free_clientCall:
|
||||
rpc_client_call_free(clientCall);
|
||||
out_free_pdu:
|
||||
free(request_pdu);
|
||||
if (buffer)
|
||||
free (buffer);
|
||||
if (Buffers[1].pvBuffer)
|
||||
free (Buffers[1].pvBuffer);
|
||||
if (request_pdu)
|
||||
free(request_pdu);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue