(trunk libT) heap pruning: using the same mechanism as in r12388, avoid an unnecessary malloc+memcpy+free when TR_CURL_VERBOSE is logging HTTP messages

This commit is contained in:
Jordan Lee 2011-04-27 20:50:43 +00:00
parent 5681ea73e2
commit aa41779aaa
1 changed files with 4 additions and 3 deletions

View File

@ -211,9 +211,10 @@ on_announce_done( tr_session * session,
if( getenv( "TR_CURL_VERBOSE" ) != NULL )
{
char * str = tr_bencToStr( &benc, TR_FMT_JSON, NULL );
fprintf( stderr, "Announce response:\n< %s\n", str );
tr_free( str );
struct evbuffer * buf = evbuffer_new( );
tr_bencToBuf( &benc, TR_FMT_JSON, buf );
fprintf( stderr, "Announce response:\n< %s\n", evbuffer_pullup( buf, -1 ) );
tr_free( buf );
}
if( benc_loaded && tr_bencIsDict( &benc ) )