Ignore:
Timestamp:
Oct 14, 2008, 3:03:29 AM (13 years ago)
Author:
charles
Message:

have tr_buildPath() allocate memory from the heap rather than using an input buffer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/fdlimit.c

    r6893 r6896  
    114114    struct tr_openfile * file = &gFd->open[i];
    115115    int                  flags;
    116     char                 filename[MAX_PATH_LENGTH];
     116    char               * filename;
    117117    struct stat          sb;
    118118
     
    122122
    123123    /* create subfolders, if any */
    124     tr_buildPath ( filename, sizeof( filename ), folder, torrentFile, NULL );
     124    filename = tr_buildPath( folder, torrentFile, NULL );
    125125    if( write )
    126126    {
     
    128128        const int err = tr_mkdirp( dirname( tmp ), 0777 ) ? errno : 0;
    129129        tr_free( tmp );
     130        tr_free( filename );
    130131        if( err )
    131132            return err;
     
    146147        tr_err( _( "Couldn't open \"%1$s\": %2$s" ), filename,
    147148               tr_strerror( err ) );
     149        tr_free( filename );
    148150        return err;
    149151    }
    150152
     153    tr_free( filename );
    151154    return 0;
    152155}
     
    186189    int                  i, winner = -1;
    187190    struct tr_openfile * o;
    188     char                 filename[MAX_PATH_LENGTH];
     191    char               * filename;
    189192
    190193    assert( folder && *folder );
     
    192195    assert( write == 0 || write == 1 );
    193196
    194     tr_buildPath ( filename, sizeof( filename ), folder, torrentFile, NULL );
     197    filename = tr_buildPath( folder, torrentFile, NULL );
    195198    dbgmsg( "looking for file '%s', writable %c", filename,
    196199            write ? 'y' : 'n' );
     
    284287        if( err ) {
    285288            tr_lockUnlock( gFd->lock );
     289            tr_free( filename );
    286290            errno = err;
    287291            return -1;
     
    298302    o->closeWhenDone = 0;
    299303    o->date = tr_date( );
     304    tr_free( filename );
    300305    tr_lockUnlock( gFd->lock );
    301306    return o->fd;
Note: See TracChangeset for help on using the changeset viewer.