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/objects | |
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/objects')
-rw-r--r-- | crypto/objects/obj_err.c | 3 | ||||
-rw-r--r-- | crypto/objects/obj_xref.c | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/crypto/objects/obj_err.c b/crypto/objects/obj_err.c index ef36313ccf..9b4779ad4d 100644 --- a/crypto/objects/obj_err.c +++ b/crypto/objects/obj_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 @@ -15,6 +15,7 @@ static const ERR_STRING_DATA OBJ_str_functs[] = { {ERR_PACK(ERR_LIB_OBJ, OBJ_F_OBJ_ADD_OBJECT, 0), "OBJ_add_object"}, + {ERR_PACK(ERR_LIB_OBJ, OBJ_F_OBJ_ADD_SIGID, 0), "OBJ_add_sigid"}, {ERR_PACK(ERR_LIB_OBJ, OBJ_F_OBJ_CREATE, 0), "OBJ_create"}, {ERR_PACK(ERR_LIB_OBJ, OBJ_F_OBJ_DUP, 0), "OBJ_dup"}, {ERR_PACK(ERR_LIB_OBJ, OBJ_F_OBJ_NAME_NEW_INDEX, 0), "OBJ_NAME_new_index"}, diff --git a/crypto/objects/obj_xref.c b/crypto/objects/obj_xref.c index 05a5c86217..166bf36adb 100644 --- a/crypto/objects/obj_xref.c +++ b/crypto/objects/obj_xref.c @@ -10,6 +10,7 @@ #include <openssl/objects.h> #include "obj_xref.h" #include "internal/nelem.h" +#include <openssl/err.h> static STACK_OF(nid_triple) *sig_app, *sigx_app; @@ -103,9 +104,10 @@ int OBJ_add_sigid(int signid, int dig_id, int pkey_id) sigx_app = sk_nid_triple_new(sigx_cmp); if (sigx_app == NULL) return 0; - ntr = OPENSSL_malloc(sizeof(*ntr)); - if (ntr == NULL) + if ((ntr = OPENSSL_malloc(sizeof(*ntr))) == NULL) { + OBJerr(OBJ_F_OBJ_ADD_SIGID, ERR_R_MALLOC_FAILURE); return 0; + } ntr->sign_id = signid; ntr->hash_id = dig_id; ntr->pkey_id = pkey_id; |