mirror of
git://erdgeist.org/opentracker
synced 2025-01-27 15:16:31 +00:00
release memory for empty peer pools
This commit is contained in:
parent
401d0759ab
commit
4569b9ffdf
@ -99,6 +99,12 @@ static int vector_remove_peer( ot_vector *vector, ot_peer *peer ) {
|
||||
vector->space /= OT_VECTOR_SHRINK_RATIO;
|
||||
vector->data = realloc( vector->data, vector->space * sizeof( ot_peer ) );
|
||||
}
|
||||
if( !vector->size ) {
|
||||
/* for peer pools its safe to let them go,
|
||||
in 999 of 1000 this happens in older pools, that won't ever grow again */
|
||||
free( vector->data );
|
||||
vector->space = 0;
|
||||
}
|
||||
return exactmatch;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user