diff options
author | Rich Salz <rsalz@openssl.org> | 2018-04-03 11:31:16 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2018-04-03 11:31:16 -0400 |
commit | cdb10bae3f773401e039c55965eb177a6f3fc160 (patch) | |
tree | c69b1b2bc385d3f600684cf8285b9ff80322c48f /crypto/pem | |
parent | 29f484d00d732ea4c19a7fd3dc0440045653e79e (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/pem')
-rw-r--r-- | crypto/pem/pem_err.c | 3 | ||||
-rw-r--r-- | crypto/pem/pvkfmt.c | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/crypto/pem/pem_err.c b/crypto/pem/pem_err.c index c4c09e4c42..f642030aa5 100644 --- a/crypto/pem/pem_err.c +++ b/crypto/pem/pem_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 @@ -26,6 +26,7 @@ static const ERR_STRING_DATA PEM_str_functs[] = { {ERR_PACK(ERR_LIB_PEM, PEM_F_DO_B2I, 0), "do_b2i"}, {ERR_PACK(ERR_LIB_PEM, PEM_F_DO_B2I_BIO, 0), "do_b2i_bio"}, {ERR_PACK(ERR_LIB_PEM, PEM_F_DO_BLOB_HEADER, 0), "do_blob_header"}, + {ERR_PACK(ERR_LIB_PEM, PEM_F_DO_I2B, 0), "do_i2b"}, {ERR_PACK(ERR_LIB_PEM, PEM_F_DO_PK8PKEY, 0), "do_pk8pkey"}, {ERR_PACK(ERR_LIB_PEM, PEM_F_DO_PK8PKEY_FP, 0), "do_pk8pkey_fp"}, {ERR_PACK(ERR_LIB_PEM, PEM_F_DO_PVK_BODY, 0), "do_PVK_body"}, diff --git a/crypto/pem/pvkfmt.c b/crypto/pem/pvkfmt.c index d0a423957c..72ae5ab257 100644 --- a/crypto/pem/pvkfmt.c +++ b/crypto/pem/pvkfmt.c @@ -444,9 +444,10 @@ static int do_i2b(unsigned char **out, EVP_PKEY *pk, int ispub) if (*out) p = *out; else { - p = OPENSSL_malloc(outlen); - if (p == NULL) + if ((p = OPENSSL_malloc(outlen)) == NULL) { + PEMerr(PEM_F_DO_I2B, ERR_R_MALLOC_FAILURE); return -1; + } *out = p; noinc = 1; } |