Fix a potential memleak if two threads fingerprint a credential simultaneously
This commit is contained in:
@@ -180,8 +180,13 @@ static bool encode(private_cred_encoding_t *this, cred_encoding_type_t type,
|
|||||||
chunk = malloc_thing(chunk_t);
|
chunk = malloc_thing(chunk_t);
|
||||||
*chunk = *encoding;
|
*chunk = *encoding;
|
||||||
this->lock->write_lock(this->lock);
|
this->lock->write_lock(this->lock);
|
||||||
this->cache[type]->put(this->cache[type], cache, chunk);
|
chunk = this->cache[type]->put(this->cache[type], cache, chunk);
|
||||||
this->lock->unlock(this->lock);
|
this->lock->unlock(this->lock);
|
||||||
|
if (chunk)
|
||||||
|
{
|
||||||
|
free(chunk->ptr);
|
||||||
|
free(chunk);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user