diff options
author | Matt Caswell <matt@openssl.org> | 2016-05-17 15:08:43 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-05-18 10:47:15 +0100 |
commit | 569d0646096e6c7e07b9b89b04204eef934c3b69 (patch) | |
tree | 8e649d1b033ec73cb6134123aa0024daf2394387 /crypto/rsa/rsa_meth.c | |
parent | 6ef020c988bb508842dfcd517a4b41cae214f641 (diff) |
Add some error messages for malloc fails
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/rsa/rsa_meth.c')
-rw-r--r-- | crypto/rsa/rsa_meth.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/crypto/rsa/rsa_meth.c b/crypto/rsa/rsa_meth.c index 731164c561..bce5ee8ba9 100644 --- a/crypto/rsa/rsa_meth.c +++ b/crypto/rsa/rsa_meth.c @@ -9,6 +9,7 @@ #include <string.h> #include "rsa_locl.h" +#include <openssl/err.h> RSA_METHOD *RSA_meth_new(const char *name, int flags) { @@ -18,6 +19,7 @@ RSA_METHOD *RSA_meth_new(const char *name, int flags) meth->name = OPENSSL_strdup(name); if (meth->name == NULL) { OPENSSL_free(meth); + RSAerr(RSA_F_RSA_METH_NEW, ERR_R_MALLOC_FAILURE); return NULL; } meth->flags = flags; @@ -46,6 +48,7 @@ RSA_METHOD *RSA_meth_dup(const RSA_METHOD *meth) ret->name = OPENSSL_strdup(meth->name); if (ret->name == NULL) { OPENSSL_free(ret); + RSAerr(RSA_F_RSA_METH_DUP, ERR_R_MALLOC_FAILURE); return NULL; } } @@ -63,8 +66,10 @@ int RSA_meth_set1_name(RSA_METHOD *meth, const char *name) char *tmpname; tmpname = OPENSSL_strdup(name); - if (tmpname == NULL) + if (tmpname == NULL) { + RSAerr(RSA_F_RSA_METH_SET1_NAME, ERR_R_MALLOC_FAILURE); return 0; + } OPENSSL_free(meth->name); meth->name = tmpname; |