diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2009-12-09 13:38:05 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2009-12-09 13:38:05 +0000 |
commit | fdb2c6e4e5b8c2065a289bca879820ea61a3c636 (patch) | |
tree | 967357e36692689f2eab5b9daf763cd21674be46 /crypto/rsa/rsa_lib.c | |
parent | 7661ccadf0f5251eb525a1dfdaed22bc406c823a (diff) |
PR: 2124
Submitted by: Jan Pechanec <Jan.Pechanec@Sun.COM>
Check for memory allocation failures.
Diffstat (limited to 'crypto/rsa/rsa_lib.c')
-rw-r--r-- | crypto/rsa/rsa_lib.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/crypto/rsa/rsa_lib.c b/crypto/rsa/rsa_lib.c index e334e506fb..de45088d76 100644 --- a/crypto/rsa/rsa_lib.c +++ b/crypto/rsa/rsa_lib.c @@ -182,7 +182,16 @@ RSA *RSA_new_method(ENGINE *engine) ret->mt_blinding=NULL; ret->bignum_data=NULL; ret->flags=ret->meth->flags; - CRYPTO_new_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data); + if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_RSA, ret, &ret->ex_data)) + { +#ifndef OPENSSL_NO_ENGINE + if (ret->engine) + ENGINE_finish(ret->engine); +#endif + OPENSSL_free(ret); + return(NULL); + } + if ((ret->meth->init != NULL) && !ret->meth->init(ret)) { #ifndef OPENSSL_NO_ENGINE |