1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-27 01:57:52 +00:00

(trunk libT) it certainly smells like we're using freed memory in the libcurl + libevent code in web.c... let's trash the structures right before free()ing them

This commit is contained in:
Charles Kerr 2009-12-18 17:32:16 +00:00
parent a653d37225
commit ef650d0398

View file

@ -23,6 +23,8 @@
enum
{
TR_MEMORY_TRASH = 0xCC,
DEFAULT_TIMER_MSEC = 1500 /* arbitrary */
};
@ -57,6 +59,7 @@ web_free( tr_web * g )
{
curl_multi_cleanup( g->multi );
evtimer_del( &g->timer_event );
memset( g, TR_MEMORY_TRASH, sizeof( struct tr_web ) );
tr_free( g );
}
@ -81,6 +84,7 @@ task_free( struct tr_web_task * task )
evbuffer_free( task->response );
tr_free( task->range );
tr_free( task->url );
memset( task, TR_MEMORY_TRASH, sizeof( struct tr_web_task ) );
tr_free( task );
}
@ -282,6 +286,7 @@ sock_cb( CURL * e UNUSED, curl_socket_t fd, int action,
if( io_event != NULL )
{
event_del( io_event );
memset( io_event, TR_MEMORY_TRASH, sizeof( struct event ) );
tr_free( io_event );
curl_multi_assign( web->multi, fd, NULL );
/*fprintf( stderr, "-1 io_events to %d\n", --num_events );*/