summaryrefslogtreecommitdiff
path: root/ext/openssl/ossl.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-10 02:19:50 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-10 02:19:50 +0000
commit351932cb4a0d0aec0d45968b32458f41ba0bf913 (patch)
tree73fb2e56a94925e6089dcfc00f2ab03f6a0b2953 /ext/openssl/ossl.c
parentc341e85b1c49fd0dce2dc809cc6c4a63b8d853f4 (diff)
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
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 e052a2c..0446d50 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]));