Changeset 1639 for branches/daemon


Ignore:
Timestamp:
Apr 2, 2007, 9:19:53 PM (15 years ago)
Author:
joshe
Message:

Fix benc list/dict allocation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/daemon/libtransmission/bencode.c

    r1612 r1639  
    3737    if( val->val.l.count + count <= val->val.l.alloc )
    3838    {
    39         return 1;
     39        return 0;
    4040    }
    4141
    4242    /* We need a bigger boat */
    4343
    44     len = val->val.l.alloc + count + ( count % LIST_SIZE ? 0 : LIST_SIZE );
     44    len = val->val.l.alloc + ( count / LIST_SIZE ) +
     45        ( count % LIST_SIZE ? LIST_SIZE : 0 );
    4546    new = realloc( val->val.l.vals, len * sizeof( benc_val_t ) );
    4647    if( NULL == new )
Note: See TracChangeset for help on using the changeset viewer.