Skip to content

Commit

Permalink
Merge pull request #6790 from bandi13/codesonar
Browse files Browse the repository at this point in the history
Clean up memory leaks
  • Loading branch information
dgarske authored Sep 19, 2023
2 parents eca28ea + 3bb0643 commit 763de1a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/x509.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions wolfssl/test.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);

Expand Down Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 763de1a

Please sign in to comment.