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; char* asn1str;
asn1str = wolfSSL_i2s_ASN1_STRING(NULL, str); asn1str = wolfSSL_i2s_ASN1_STRING(NULL, str);
if ((tmpLen = XSNPRINTF( tmpLen = XSNPRINTF(tmp, tmpSz, "%*s%s", indent, "", asn1str);
tmp, tmpSz, "%*s%s", indent, "", asn1str))
>= tmpSz)
return rc;
XFREE(asn1str, NULL, DYNAMIC_TYPE_TMP_BUFFER); XFREE(asn1str, NULL, DYNAMIC_TYPE_TMP_BUFFER);
if (tmpLen >= tmpSz) return rc;
break; break;
} }
case AUTH_INFO_OID: 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) static WC_INLINE void SetupAtomicUser(WOLFSSL_CTX* ctx, WOLFSSL* ssl)
{ {
#if !defined(NO_HMAC) && !defined(NO_AES) && defined(HAVE_AES_CBC)
AtomicEncCtx* encCtx; AtomicEncCtx* encCtx;
AtomicDecCtx* decCtx; AtomicDecCtx* decCtx;
@ -3503,7 +3504,6 @@ static WC_INLINE void SetupAtomicUser(WOLFSSL_CTX* ctx, WOLFSSL* ssl)
} }
XMEMSET(decCtx, 0, sizeof(AtomicDecCtx)); XMEMSET(decCtx, 0, sizeof(AtomicDecCtx));
#if !defined(NO_HMAC) && !defined(NO_AES) && defined(HAVE_AES_CBC)
wolfSSL_CTX_SetMacEncryptCb(ctx, myMacEncryptCb); wolfSSL_CTX_SetMacEncryptCb(ctx, myMacEncryptCb);
wolfSSL_SetMacEncryptCtx(ssl, encCtx); wolfSSL_SetMacEncryptCtx(ssl, encCtx);
@ -3539,7 +3539,7 @@ static WC_INLINE void FreeAtomicUser(WOLFSSL* ssl)
if (decCtx != NULL) { if (decCtx != NULL) {
if (decCtx->keySetup == 1) if (decCtx->keySetup == 1)
wc_AesFree(&decCtx->aes); wc_AesFree(&decCtx->aes);
free(decCtx); free(decCtx);
} }
} }