(trunk libT) use tr_valloc() in a couple of places where we allocate largish, short-term buffers

This commit is contained in:
Charles Kerr 2010-02-23 07:29:21 +00:00
parent fad8f285a8
commit 6d639f354b
2 changed files with 2 additions and 2 deletions

View File

@ -208,7 +208,7 @@ getHashInfo( tr_metainfo_builder * b )
if( !b->totalSize )
return ret;
buf = tr_new( uint8_t, b->pieceSize );
buf = tr_valloc( b->pieceSize );
b->pieceIndex = 0;
totalRemain = b->totalSize;
fp = fopen( b->files[fileIndex].filename, "rb" );

View File

@ -1428,7 +1428,7 @@ tr_moveFile( const char * oldpath, const char * newpath, tr_bool * renamed )
in = tr_open_file_for_scanning( oldpath );
out = tr_open_file_for_writing( newpath );
buflen = stat( newpath, &st ) ? 4096 : st.st_blksize;
buf = tr_new( char, buflen );
buf = tr_valloc( buflen );
while( bytesLeft > 0 )
{
ssize_t bytesWritten;