mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
ossl.c: check allocation
* ext/openssl/ossl.c (Init_ossl_locks): check if locks array is allocated successfully. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c341e85b1c
commit
351932cb4a
1 changed files with 3 additions and 0 deletions
|
@ -486,6 +486,9 @@ static void Init_ossl_locks(void)
|
|||
rb_raise(rb_eRuntimeError, "CRYPTO_num_locks() is too big: %d", num_locks);
|
||||
}
|
||||
ossl_locks = (VALUE*) OPENSSL_malloc(num_locks * (int)sizeof(VALUE));
|
||||
if (!ossl_locks) {
|
||||
rb_raise(rb_eNoMemError, "CRYPTO_num_locks() is too big: %d", num_locks);
|
||||
}
|
||||
for (i = 0; i < num_locks; i++) {
|
||||
ossl_locks[i] = rb_mutex_new();
|
||||
rb_global_variable(&(ossl_locks[i]));
|
||||
|
|
Loading…
Reference in a new issue