Merge pull request #6790 from bandi13/codesonar

Clean up memory leaks
This commit is contained in:
David Garske
2023-09-19 09:48:22 -07:00
committed by GitHub
2 changed files with 4 additions and 6 deletions

View File

@ -1565,11 +1565,9 @@ int wolfSSL_X509V3_EXT_print(WOLFSSL_BIO *out, WOLFSSL_X509_EXTENSION *ext,
{
char* asn1str;
asn1str = wolfSSL_i2s_ASN1_STRING(NULL, str);
if ((tmpLen = XSNPRINTF(
tmp, tmpSz, "%*s%s", indent, "", asn1str))
>= tmpSz)
return rc;
tmpLen = XSNPRINTF(tmp, tmpSz, "%*s%s", indent, "", asn1str);
XFREE(asn1str, NULL, DYNAMIC_TYPE_TMP_BUFFER);
if (tmpLen >= tmpSz) return rc;
break;
}
case AUTH_INFO_OID:

View File

@ -3488,6 +3488,7 @@ static WC_INLINE int myVerifyDecryptCb(WOLFSSL* ssl,
static WC_INLINE void SetupAtomicUser(WOLFSSL_CTX* ctx, WOLFSSL* ssl)
{
#if !defined(NO_HMAC) && !defined(NO_AES) && defined(HAVE_AES_CBC)
AtomicEncCtx* encCtx;
AtomicDecCtx* decCtx;
@ -3503,7 +3504,6 @@ static WC_INLINE void SetupAtomicUser(WOLFSSL_CTX* ctx, WOLFSSL* ssl)
}
XMEMSET(decCtx, 0, sizeof(AtomicDecCtx));
#if !defined(NO_HMAC) && !defined(NO_AES) && defined(HAVE_AES_CBC)
wolfSSL_CTX_SetMacEncryptCb(ctx, myMacEncryptCb);
wolfSSL_SetMacEncryptCtx(ssl, encCtx);
@ -3539,7 +3539,7 @@ static WC_INLINE void FreeAtomicUser(WOLFSSL* ssl)
if (decCtx != NULL) {
if (decCtx->keySetup == 1)
wc_AesFree(&decCtx->aes);
free(decCtx);
free(decCtx);
}
}