summaryrefslogtreecommitdiff
path: root/ext/openssl/ossl.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/openssl/ossl.c')
-rw-r--r--ext/openssl/ossl.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c
index e052a2ce09..0446d5085b 100644
--- a/ext/openssl/ossl.c
+++ b/ext/openssl/ossl.c
@@ -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]));