mirror of
https://github.com/transmission/transmission
synced 2024-12-24 00:34:04 +00:00
Fix benc list/dict allocation.
This commit is contained in:
parent
9bb7063378
commit
574902b461
1 changed files with 3 additions and 2 deletions
|
@ -36,12 +36,13 @@ static int makeroom( benc_val_t * val, int count )
|
|||
|
||||
if( val->val.l.count + count <= val->val.l.alloc )
|
||||
{
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 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 ) );
|
||||
if( NULL == new )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue