From cdb10bae3f773401e039c55965eb177a6f3fc160 Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Tue, 3 Apr 2018 11:31:16 -0400 Subject: Set error code on alloc failures Almost all *alloc failures now set an error code. Reviewed-by: Matthias St. Pierre (Merged from https://github.com/openssl/openssl/pull/5842) --- crypto/async/async_err.c | 4 +++- crypto/async/async_wait.c | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'crypto/async') diff --git a/crypto/async/async_err.c b/crypto/async/async_err.c index d2d1011ccb..fd5527aae8 100644 --- a/crypto/async/async_err.c +++ b/crypto/async/async_err.c @@ -1,6 +1,6 @@ /* * Generated by util/mkerr.pl DO NOT EDIT - * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -21,6 +21,8 @@ static const ERR_STRING_DATA ASYNC_str_functs[] = { {ERR_PACK(ERR_LIB_ASYNC, ASYNC_F_ASYNC_PAUSE_JOB, 0), "ASYNC_pause_job"}, {ERR_PACK(ERR_LIB_ASYNC, ASYNC_F_ASYNC_START_FUNC, 0), "async_start_func"}, {ERR_PACK(ERR_LIB_ASYNC, ASYNC_F_ASYNC_START_JOB, 0), "ASYNC_start_job"}, + {ERR_PACK(ERR_LIB_ASYNC, ASYNC_F_ASYNC_WAIT_CTX_SET_WAIT_FD, 0), + "ASYNC_WAIT_CTX_set_wait_fd"}, {0, NULL} }; diff --git a/crypto/async/async_wait.c b/crypto/async/async_wait.c index d6d469527a..788c7cdd8c 100644 --- a/crypto/async/async_wait.c +++ b/crypto/async/async_wait.c @@ -47,9 +47,10 @@ int ASYNC_WAIT_CTX_set_wait_fd(ASYNC_WAIT_CTX *ctx, const void *key, { struct fd_lookup_st *fdlookup; - fdlookup = OPENSSL_zalloc(sizeof(*fdlookup)); - if (fdlookup == NULL) + if ((fdlookup = OPENSSL_zalloc(sizeof(*fdlookup))) == NULL) { + ASYNCerr(ASYNC_F_ASYNC_WAIT_CTX_SET_WAIT_FD, ERR_R_MALLOC_FAILURE); return 0; + } fdlookup->key = key; fdlookup->fd = fd; -- cgit v1.2.3