Changeset 10152


Ignore:
Timestamp:
Feb 10, 2010, 3:26:19 AM (12 years ago)
Author:
charles
Message:

(trunk libT) #2887 "dangling pointer in 1.81" -- fixed in trunk for 1.90 / 1.8x

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/web.c

    r10146 r10152  
    9191    struct evbuffer * response;
    9292    char * url;
     93    char * resolved_url;
    9394    char * host;
    9495    const char * resolved_host;
     
    113114    tr_free( task->host );
    114115    tr_free( task->range );
     116    tr_free( task->resolved_url );
    115117    tr_free( task->url );
    116118    memset( task, TR_MEMORY_TRASH, sizeof( struct tr_web_task ) );
     
    323325        const long verbose = getenv( "TR_CURL_VERBOSE" ) != NULL;
    324326        const char * user_agent = TR_NAME "/" SHORT_VERSION_STRING;
    325         char * url = NULL;
    326327
    327328        /* insert the resolved host into the URL s.t. curl's DNS won't block
     
    337338            evbuffer_add_printf( buf, "%s", task->resolved_host );
    338339            evbuffer_add_printf( buf, "%s", tail );
    339             url = tr_strndup( EVBUFFER_DATA( buf ), EVBUFFER_LENGTH( buf ) );
    340             dbgmsg( "old url: \"%s\" -- new url: \"%s\"", task->url, url );
     340            task->resolved_url = tr_strndup( EVBUFFER_DATA( buf ), EVBUFFER_LENGTH( buf ) );
     341            dbgmsg( "old url: \"%s\" -- new url: \"%s\"", task->url, task->resolved_url );
    341342            evbuffer_free( buf );
    342343
     
    355356        }
    356357
    357         dbgmsg( "adding task #%lu [%s]", task->tag, url ? url : task->url );
     358        dbgmsg( "adding task #%lu [%s]", task->tag, task->resolved_url ? task->resolved_url : task->url );
    358359
    359360        if( !task->range && session->isProxyEnabled ) {
     
    390391        curl_easy_setopt( e, CURLOPT_SSL_VERIFYHOST, 0L );
    391392        curl_easy_setopt( e, CURLOPT_SSL_VERIFYPEER, 0L );
    392         curl_easy_setopt( e, CURLOPT_URL, url ? url : task->url );
     393        curl_easy_setopt( e, CURLOPT_URL, task->resolved_url ? task->resolved_url : task->url );
    393394        curl_easy_setopt( e, CURLOPT_USERAGENT, user_agent );
    394395        curl_easy_setopt( e, CURLOPT_VERBOSE, verbose );
     
    400401        if( curl_multi_add_handle( web->multi, e ) == CURLM_OK )
    401402            ++web->taskCount;
    402 
    403         tr_free( url );
    404403    }
    405404}
Note: See TracChangeset for help on using the changeset viewer.