diff options
author | Rich Salz <rsalz@openssl.org> | 2018-04-26 14:02:24 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2018-04-26 14:02:24 -0400 |
commit | fe1128dc2a6e7aae9010cf6595c78245e0eefd46 (patch) | |
tree | de62e713f375adaefd7e6bfd8491575c0fc530a3 /crypto/stack | |
parent | 74a8acbdfb2c7f398d1ae2fe914cd32b437f6df4 (diff) |
Fix last(?) batch of malloc-NULL places
Add a script to find them in the future
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/6103)
Diffstat (limited to 'crypto/stack')
-rw-r--r-- | crypto/stack/stack.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/crypto/stack/stack.c b/crypto/stack/stack.c index 5fc4eb87f2..975515db59 100644 --- a/crypto/stack/stack.c +++ b/crypto/stack/stack.c @@ -46,8 +46,10 @@ OPENSSL_STACK *OPENSSL_sk_dup(const OPENSSL_STACK *sk) { OPENSSL_STACK *ret; - if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) + if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) { + CRYPTOerr(CRYPTO_F_OPENSSL_SK_DUP, ERR_R_MALLOC_FAILURE); return NULL; + } /* direct structure assignment */ *ret = *sk; @@ -75,8 +77,10 @@ OPENSSL_STACK *OPENSSL_sk_deep_copy(const OPENSSL_STACK *sk, OPENSSL_STACK *ret; int i; - if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) + if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) { + CRYPTOerr(CRYPTO_F_OPENSSL_SK_DEEP_COPY, ERR_R_MALLOC_FAILURE); return NULL; + } /* direct structure assignment */ *ret = *sk; @@ -174,7 +178,7 @@ static int sk_reserve(OPENSSL_STACK *st, int n, int exact) * so |num_alloc| value is |n| or |min_nodes| if greater than |n|. */ if ((st->data = OPENSSL_zalloc(sizeof(void *) * num_alloc)) == NULL) { - /* STACKerr(STACK_F_SK_RESERVE, ERR_R_MALLOC_FAILURE); */ + CRYPTOerr(CRYPTO_F_SK_RESERVE, ERR_R_MALLOC_FAILURE); return 0; } st->num_alloc = num_alloc; |