提交 0b2fc928 编写于 作者: F FdaSilvaYY 提交者: Rich Salz

GH773: Possible leak on CRYPTO_THREAD_lock_new failure

Signed-off-by: NRich Salz <rsalz@akamai.com>
Reviewed-by: NMatt Caswell <matt@openssl.org>
上级 e257b2c2
......@@ -58,8 +58,10 @@ CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void)
if (lock == NULL)
return NULL;
if (pthread_rwlock_init(lock, NULL) != 0)
if (pthread_rwlock_init(lock, NULL) != 0) {
OPENSSL_free(lock);
return NULL;
}
return lock;
}
......
......@@ -59,8 +59,10 @@ CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void)
return NULL;
/* 0x400 is the spin count value suggested in the documentation */
if (!InitializeCriticalSectionAndSpinCount(lock, 0x400))
if (!InitializeCriticalSectionAndSpinCount(lock, 0x400)) {
OPENSSL_free(lock);
return NULL;
}
return lock;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册