In mem_pool, check for an existing ID entry before creating a new one
This commit is contained in:
@@ -272,13 +272,16 @@ static int get_new(private_mem_pool_t *this, identification_t *id)
|
|||||||
|
|
||||||
if (this->unused < this->size)
|
if (this->unused < this->size)
|
||||||
{
|
{
|
||||||
INIT(entry,
|
entry = this->leases->get(this->leases, id);
|
||||||
.id = id->clone(id),
|
if (!entry)
|
||||||
.online = linked_list_create(),
|
{
|
||||||
.offline = linked_list_create(),
|
INIT(entry,
|
||||||
);
|
.id = id->clone(id),
|
||||||
this->leases->put(this->leases, entry->id, entry);
|
.online = linked_list_create(),
|
||||||
|
.offline = linked_list_create(),
|
||||||
|
);
|
||||||
|
this->leases->put(this->leases, entry->id, entry);
|
||||||
|
}
|
||||||
/* assigning offset, starting by 1 */
|
/* assigning offset, starting by 1 */
|
||||||
offset = ++this->unused;
|
offset = ++this->unused;
|
||||||
entry->online->insert_last(entry->online, (void*)offset);
|
entry->online->insert_last(entry->online, (void*)offset);
|
||||||
|
|||||||
Reference in New Issue
Block a user