1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 08:43:27 +00:00

Fix benc list/dict allocation.

This commit is contained in:
Josh Elsasser 2007-04-02 21:19:53 +00:00
parent 9bb7063378
commit 574902b461

View file

@ -36,12 +36,13 @@ static int makeroom( benc_val_t * val, int count )
if( val->val.l.count + count <= val->val.l.alloc ) if( val->val.l.count + count <= val->val.l.alloc )
{ {
return 1; return 0;
} }
/* We need a bigger boat */ /* We need a bigger boat */
len = val->val.l.alloc + count + ( count % LIST_SIZE ? 0 : LIST_SIZE ); len = val->val.l.alloc + ( count / LIST_SIZE ) +
( count % LIST_SIZE ? LIST_SIZE : 0 );
new = realloc( val->val.l.vals, len * sizeof( benc_val_t ) ); new = realloc( val->val.l.vals, len * sizeof( benc_val_t ) );
if( NULL == new ) if( NULL == new )
{ {