Changeset 9813


Ignore:
Timestamp:
Dec 23, 2009, 4:12:18 PM (12 years ago)
Author:
charles
Message:

(trunk libT) #2416 "crash in event_queue_insert" -- possible fix. it looks like the kqueue client is accessing the event after the callback and after event_del() is being called. *If* that's the case I don't know if it's a libevent bug or if libtransmission is making assumptions it shouldn't've... but it's easy enough to keep the memory in a pool and free it later when it's safer to do so.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/web.c

    r9798 r9813  
    1515
    1616#include "transmission.h"
     17#include "list.h"
    1718#include "net.h"
    1819#include "session.h"
     
    5354    tr_address addr;
    5455    struct event timer_event;
     56    tr_list * freeme;
    5557};
    5658
     
    5961{
    6062    curl_multi_cleanup( g->multi );
     63    tr_list_free( &g->freeme, tr_free );
    6164    evtimer_del( &g->timer_event );
    6265    memset( g, TR_MEMORY_TRASH, sizeof( struct tr_web ) );
     
    288291            event_del( io_event );
    289292            memset( io_event, TR_MEMORY_TRASH, sizeof( struct event ) );
    290             tr_free( io_event );
     293            tr_list_append( &web->freeme, io_event );
    291294            curl_multi_assign( web->multi, fd, NULL );
    292295            /*fprintf( stderr, "-1 io_events to %d\n", --num_events );*/
     
    319322/* libevent says that timer_msec have passed, so wake up libcurl */
    320323static void
    321 libevent_timer_cb( int fd UNUSED, short what UNUSED, void * g )
    322 {
     324libevent_timer_cb( int fd UNUSED, short what UNUSED, void * vg )
     325{
     326    tr_web * g = vg;
     327    tr_list_free( &g->freeme, tr_free );
    323328    dbgmsg( "libevent timer is done" );
    324329    tr_multi_perform( g, CURL_SOCKET_TIMEOUT, 0 );
Note: See TracChangeset for help on using the changeset viewer.