File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8210,7 +8210,7 @@ void SSL_ResourceFree(WOLFSSL* ssl)
82108210 if (FreeFixedIO(ctx_heap, &(ssl_hint->inBuf)) != 1) {
82118211 WOLFSSL_MSG("Error freeing fixed output buffer");
82128212 }
8213- if (ssl_hint->haFlag) { /* check if handshake count has been decreased*/
8213+ if (ssl_hint->haFlag && ctx_heap->curHa > 0 ) { /* check if handshake count has been decreased*/
82148214 ctx_heap->curHa--;
82158215 }
82168216 wc_UnLockMutex(&(ctx_heap->memory_mutex));
@@ -8464,7 +8464,9 @@ void FreeHandshakeResources(WOLFSSL* ssl)
84648464 if (wc_LockMutex(&(ctx_heap->memory_mutex)) != 0) {
84658465 WOLFSSL_MSG("Bad memory_mutex lock");
84668466 }
8467- ctx_heap->curHa--;
8467+ if (ctx_heap->curHa > 0) {
8468+ ctx_heap->curHa--;
8469+ }
84688470 ssl_hint->haFlag = 0; /* set to zero since handshake has been dec */
84698471 wc_UnLockMutex(&(ctx_heap->memory_mutex));
84708472 #ifdef WOLFSSL_HEAP_TEST
You can’t perform that action at this time.
0 commit comments