Avoid a race condition if another thread happens to remove the error
state at the same time.
This commit is contained in:
parent
ccb9aae905
commit
34f0fe9de0
@ -652,12 +652,15 @@ void ERR_remove_state(unsigned long pid)
|
|||||||
pid=(unsigned long)CRYPTO_thread_id();
|
pid=(unsigned long)CRYPTO_thread_id();
|
||||||
tmp.pid=pid;
|
tmp.pid=pid;
|
||||||
CRYPTO_w_lock(CRYPTO_LOCK_ERR);
|
CRYPTO_w_lock(CRYPTO_LOCK_ERR);
|
||||||
p=(ERR_STATE *)lh_delete(thread_hash,&tmp);
|
if (thread_hash)
|
||||||
if (lh_num_items(thread_hash) == 0)
|
|
||||||
{
|
{
|
||||||
/* make sure we don't leak memory */
|
p=(ERR_STATE *)lh_delete(thread_hash,&tmp);
|
||||||
lh_free(thread_hash);
|
if (lh_num_items(thread_hash) == 0)
|
||||||
thread_hash = NULL;
|
{
|
||||||
|
/* make sure we don't leak memory */
|
||||||
|
lh_free(thread_hash);
|
||||||
|
thread_hash = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
|
CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user