mirror of
https://github.com/transmission/transmission
synced 2025-02-25 15:32:33 +00:00
(trunk libT) more heap pruning: avoid an unnecessary malloc() + free() when reading PadD during an outbound encrypted handshake
This commit is contained in:
parent
758da07fe9
commit
4694f95594
1 changed files with 1 additions and 4 deletions
|
@ -571,16 +571,13 @@ readPadD( tr_handshake * handshake,
|
|||
struct evbuffer * inbuf )
|
||||
{
|
||||
const size_t needlen = handshake->pad_d_len;
|
||||
uint8_t * tmp;
|
||||
|
||||
dbgmsg( handshake, "pad d: need %zu, got %zu",
|
||||
needlen, evbuffer_get_length( inbuf ) );
|
||||
if( evbuffer_get_length( inbuf ) < needlen )
|
||||
return READ_LATER;
|
||||
|
||||
tmp = tr_new( uint8_t, needlen );
|
||||
tr_peerIoReadBytes( handshake->io, inbuf, tmp, needlen );
|
||||
tr_free( tmp );
|
||||
tr_peerIoDrain( handshake->io, inbuf, needlen );
|
||||
|
||||
tr_peerIoSetEncryption( handshake->io, handshake->crypto_select );
|
||||
|
||||
|
|
Loading…
Reference in a new issue