diff options
author | Rich Salz <rsalz@openssl.org> | 2016-02-08 16:11:56 +0100 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2016-02-08 17:09:16 +0100 |
commit | 43ecb9c35caed8623cfd83e7d893b8b67725feb7 (patch) | |
tree | 676696126afa484d7afeba51771fdc8d41cc04ab /crypto/hmac | |
parent | Use File::Path::rmtree rather than File::Path::remove_tree (diff) | |
download | openssl-43ecb9c35caed8623cfd83e7d893b8b67725feb7.tar.xz openssl-43ecb9c35caed8623cfd83e7d893b8b67725feb7.zip |
GH641: Don't care openssl_zmalloc
Don't cast malloc-family return values.
Also found some places where (a) blank line was missing; and (b)
the *wrong* return value was checked.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/hmac')
-rw-r--r-- | crypto/hmac/hmac.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/crypto/hmac/hmac.c b/crypto/hmac/hmac.c index f372955c60..9504aada94 100644 --- a/crypto/hmac/hmac.c +++ b/crypto/hmac/hmac.c @@ -171,12 +171,14 @@ size_t HMAC_size(HMAC_CTX *ctx) HMAC_CTX *HMAC_CTX_new(void) { - HMAC_CTX *ctx = (HMAC_CTX *)OPENSSL_zalloc(sizeof(HMAC_CTX)); - if (ctx) + HMAC_CTX *ctx = OPENSSL_zalloc(sizeof(HMAC_CTX)); + + if (ctx != NULL) { if (!HMAC_CTX_reset(ctx)) { HMAC_CTX_free(ctx); - ctx = NULL; + return NULL; } + } return ctx; } |