diff options
author | Rich Salz <rsalz@openssl.org> | 2018-04-03 17:31:16 +0200 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2018-04-03 17:31:16 +0200 |
commit | cdb10bae3f773401e039c55965eb177a6f3fc160 (patch) | |
tree | c69b1b2bc385d3f600684cf8285b9ff80322c48f /crypto/srp | |
parent | Fix some errors in the mem leaks docs (diff) | |
download | openssl-cdb10bae3f773401e039c55965eb177a6f3fc160.tar.xz openssl-cdb10bae3f773401e039c55965eb177a6f3fc160.zip |
Set error code on alloc failures
Almost all *alloc failures now set an error code.
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/5842)
Diffstat (limited to 'crypto/srp')
-rw-r--r-- | crypto/srp/srp_vfy.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/crypto/srp/srp_vfy.c b/crypto/srp/srp_vfy.c index b85033b305..38d1a0f36a 100644 --- a/crypto/srp/srp_vfy.c +++ b/crypto/srp/srp_vfy.c @@ -19,6 +19,7 @@ # include <openssl/buffer.h> # include <openssl/rand.h> # include <openssl/txt_db.h> +# include <openssl/err.h> # define SRP_RANDOM_SALT_LEN 20 # define MAX_LEN 2500 @@ -58,9 +59,12 @@ void SRP_user_pwd_free(SRP_user_pwd *user_pwd) static SRP_user_pwd *SRP_user_pwd_new(void) { - SRP_user_pwd *ret = OPENSSL_malloc(sizeof(*ret)); - if (ret == NULL) + SRP_user_pwd *ret; + + if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) { + /* SRPerr(SRP_F_SRP_USER_PWD_NEW, ERR_R_MALLOC_FAILURE); */ return NULL; + } ret->N = NULL; ret->g = NULL; ret->s = NULL; |