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/asn1/a_strnid.c | |
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/asn1/a_strnid.c')
-rw-r--r-- | crypto/asn1/a_strnid.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/asn1/a_strnid.c b/crypto/asn1/a_strnid.c index a7d6b0e3df..948fc1f11a 100644 --- a/crypto/asn1/a_strnid.c +++ b/crypto/asn1/a_strnid.c @@ -156,9 +156,10 @@ static ASN1_STRING_TABLE *stable_get(int nid) tmp = ASN1_STRING_TABLE_get(nid); if (tmp != NULL && tmp->flags & STABLE_FLAGS_MALLOC) return tmp; - rv = OPENSSL_zalloc(sizeof(*rv)); - if (rv == NULL) + if ((rv = OPENSSL_zalloc(sizeof(*rv))) == NULL) { + ASN1err(ASN1_F_STABLE_GET, ERR_R_MALLOC_FAILURE); return NULL; + } if (!sk_ASN1_STRING_TABLE_push(stable, rv)) { OPENSSL_free(rv); return NULL; |