summaryrefslogtreecommitdiffstats
path: root/crypto/init.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@openssl.org>2018-04-03 11:31:16 -0400
committerRich Salz <rsalz@openssl.org>2018-04-03 11:31:16 -0400
commitcdb10bae3f773401e039c55965eb177a6f3fc160 (patch)
treec69b1b2bc385d3f600684cf8285b9ff80322c48f /crypto/init.c
parent29f484d00d732ea4c19a7fd3dc0440045653e79e (diff)
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/init.c')
-rw-r--r--crypto/init.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/init.c b/crypto/init.c
index a0bad564e6..37b7a7c72e 100644
--- a/crypto/init.c
+++ b/crypto/init.c
@@ -708,9 +708,10 @@ int OPENSSL_atexit(void (*handler)(void))
}
#endif
- newhand = OPENSSL_malloc(sizeof(*newhand));
- if (newhand == NULL)
+ if ((newhand = OPENSSL_malloc(sizeof(*newhand))) == NULL) {
+ CRYPTOerr(CRYPTO_F_OPENSSL_ATEXIT, ERR_R_MALLOC_FAILURE);
return 0;
+ }
newhand->handler = handler;
newhand->next = stop_handlers;