From: Jordan Lee Date: Wed, 27 Apr 2011 20:50:43 +0000 (+0000) Subject: (trunk libT) heap pruning: using the same mechanism as in r12388, avoid an unnecessar... X-Git-Tag: 2.30b4~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aa41779aaa1e24472473d4158ab1d769cad903aa;p=transmission (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 --- diff --git a/libtransmission/announcer-http.c b/libtransmission/announcer-http.c index b82611958..60cb71791 100644 --- a/libtransmission/announcer-http.c +++ b/libtransmission/announcer-http.c @@ -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 ) )