summaryrefslogtreecommitdiffstats
path: root/ssl/ssl_ciph.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2018-04-03 17:31:16 +0200
committerRich Salz <rsalz@openssl.org>2018-04-03 17:31:16 +0200
commitcdb10bae3f773401e039c55965eb177a6f3fc160 (patch)
treec69b1b2bc385d3f600684cf8285b9ff80322c48f /ssl/ssl_ciph.c
parentFix some errors in the mem leaks docs (diff)
downloadopenssl-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 'ssl/ssl_ciph.c')
-rw-r--r--ssl/ssl_ciph.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ssl/ssl_ciph.c b/ssl/ssl_ciph.c
index 49e16fc695..be728dfbe8 100644
--- a/ssl/ssl_ciph.c
+++ b/ssl/ssl_ciph.c
@@ -1523,9 +1523,10 @@ char *SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int len)
if (buf == NULL) {
len = 128;
- buf = OPENSSL_malloc(len);
- if (buf == NULL)
+ if ((buf = OPENSSL_malloc(len)) == NULL) {
+ SSLerr(SSL_F_SSL_CIPHER_DESCRIPTION, ERR_R_MALLOC_FAILURE);
return NULL;
+ }
} else if (len < 128) {
return NULL;
}