diff options
author | Rich Salz <rsalz@openssl.org> | 2018-04-03 17:31:16 +0200 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2018-04-03 17:31:16 +0200 |
commit | cdb10bae3f773401e039c55965eb177a6f3fc160 (patch) | |
tree | c69b1b2bc385d3f600684cf8285b9ff80322c48f /crypto/stack | |
parent | Fix some errors in the mem leaks docs (diff) | |
download | openssl-cdb10bae3f773401e039c55965eb177a6f3fc160.tar.xz openssl-cdb10bae3f773401e039c55965eb177a6f3fc160.zip |
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/stack')
-rw-r--r-- | crypto/stack/stack.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/stack/stack.c b/crypto/stack/stack.c index fc755e36b6..97c3e87e0e 100644 --- a/crypto/stack/stack.c +++ b/crypto/stack/stack.c @@ -173,9 +173,10 @@ static int sk_reserve(OPENSSL_STACK *st, int n, int exact) * At this point, |st->num_alloc| and |st->num| are 0; * so |num_alloc| value is |n| or |min_nodes| if greater than |n|. */ - st->data = OPENSSL_zalloc(sizeof(void *) * num_alloc); - if (st->data == NULL) + if ((st->data = OPENSSL_zalloc(sizeof(void *) * num_alloc)) == NULL) { + /* STACKerr(STACK_F_SK_RESERVE, ERR_R_MALLOC_FAILURE); */ return 0; + } st->num_alloc = num_alloc; return 1; } |