@@ -2830,7 +2830,7 @@ static WC_INLINE int myMacEncryptCb(WOLFSSL* ssl, unsigned char* macOut,
28302830 ret = wc_HmacFinal (& hmac , macOut );
28312831 if (ret != 0 )
28322832 return ret ;
2833-
2833+ wc_HmacFree ( & hmac );
28342834
28352835 /* encrypt setup on first time */
28362836 if (encCtx -> keySetup == 0 ) {
@@ -2959,6 +2959,7 @@ static WC_INLINE int myDecryptVerifyCb(WOLFSSL* ssl,
29592959 ret = wc_HmacFinal (& hmac , verify );
29602960 if (ret != 0 )
29612961 return ret ;
2962+ wc_HmacFree (& hmac );
29622963
29632964 if (XMEMCMP (verify , decOut + decSz - digestSz - pad - padByte ,
29642965 (size_t ) digestSz ) != 0 ) {
@@ -3041,7 +3042,9 @@ static WC_INLINE int myEncryptMacCb(WOLFSSL* ssl, unsigned char* macOut,
30413042 ret = wc_HmacUpdate (& hmac , encOut , encSz );
30423043 if (ret != 0 )
30433044 return ret ;
3044- return wc_HmacFinal (& hmac , macOut );
3045+ ret = wc_HmacFinal (& hmac , macOut );
3046+ wc_HmacFree (& hmac );
3047+ return ret ;
30453048}
30463049
30473050
@@ -3088,6 +3091,7 @@ static WC_INLINE int myVerifyDecryptCb(WOLFSSL* ssl,
30883091 ret = wc_HmacFinal (& hmac , verify );
30893092 if (ret != 0 )
30903093 return ret ;
3094+ wc_HmacFree (& hmac );
30913095
30923096 if (XMEMCMP (verify , decOut + decSz , (size_t ) digestSz ) != 0 ) {
30933097 printf ("myDecryptVerify verify failed\n" );
0 commit comments