Skip to content

Commit 3ffa625

Browse files
committed
Fix leak in Aria upon error
1 parent 2d2efcc commit 3ffa625

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/internal.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20332,8 +20332,10 @@ static WC_INLINE int EncryptDo(WOLFSSL* ssl, byte* out, const byte* input,
2033220332
out + sz - ssl->specs.aead_mac_size,
2033320333
ssl->specs.aead_mac_size
2033420334
);
20335-
if (ret != 0)
20335+
if (ret != 0) {
20336+
XFREE(outBuf, ssl->heap, DYNAMIC_TYPE_TMP_BUFFER);
2033620337
break;
20338+
}
2033720339
XMEMCPY(out,
2033820340
ssl->encrypt.nonce + AESGCM_IMP_IV_SZ, AESGCM_EXP_IV_SZ);
2033920341
XMEMCPY(out + AESGCM_EXP_IV_SZ,outBuf,sz - AESGCM_EXP_IV_SZ);
@@ -20805,8 +20807,10 @@ static WC_INLINE int DecryptDo(WOLFSSL* ssl, byte* plain, const byte* input,
2080520807
(byte *)input + sz - ssl->specs.aead_mac_size,
2080620808
ssl->specs.aead_mac_size
2080720809
);
20808-
if (ret != 0)
20810+
if (ret != 0) {
20811+
XFREE(outBuf, ssl->heap, DYNAMIC_TYPE_TMP_BUFFER);
2080920812
break;
20813+
}
2081020814
XMEMCPY(plain + AESGCM_EXP_IV_SZ,
2081120815
outBuf,
2081220816
sz - AESGCM_EXP_IV_SZ - ssl->specs.aead_mac_size);

0 commit comments

Comments
 (0)