X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fhmac%2Fhmac.c;h=9504aada943bd337f7fef851c5de82f7325f2626;hp=f372955c60d21a549a9ff3de65db0b6992736658;hb=43ecb9c35caed8623cfd83e7d893b8b67725feb7;hpb=4500a4cd4d89ba338ad796d39ccb9d94794cc0d7 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; }