Skip to content

Commit 4e2e1eb

Browse files
committed
Add err check per review comments
1 parent e6997da commit 4e2e1eb

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

test/test_cipher.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -603,10 +603,14 @@ int test_aes_ctr_leftover_data_regression(ENGINE *e, void *data)
603603
* The EVP_CIPHER_CTX remembers any engine it was loaded with, meaning we
604604
* need to reset the ctxs before reuse or the decCtx will still pick up
605605
* wolfEngine */
606-
if (encCtx != NULL)
607-
EVP_CIPHER_CTX_free(encCtx);
608-
if (decCtx != NULL)
609-
EVP_CIPHER_CTX_free(decCtx);
606+
if (err == 0) {
607+
if (encCtx != NULL)
608+
EVP_CIPHER_CTX_free(encCtx);
609+
}
610+
if (err == 0) {
611+
if (decCtx != NULL)
612+
EVP_CIPHER_CTX_free(decCtx);
613+
}
610614

611615
if (err == 0) {
612616
err = (encCtx = EVP_CIPHER_CTX_new()) == NULL;

0 commit comments

Comments
 (0)