Skip to content

Commit 3034dd9

Browse files
committed
dtls13: release mutex on error
1 parent 7efc962 commit 3034dd9

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/dtls13.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,9 @@ int Dtls13RtxAddAck(WOLFSSL* ssl, w64wrapper epoch, w64wrapper seq)
737737
for (; cur != NULL; prevNext = &cur->next, cur = cur->next) {
738738
if (w64Equal(cur->epoch, epoch) && w64Equal(cur->seq, seq)) {
739739
/* already in list. no duplicates. */
740+
#ifdef WOLFSSL_RW_THREADED
741+
wc_UnLockMutex(&ssl->dtls13Rtx.mutex);
742+
#endif
740743
return 0;
741744
}
742745
else if (w64LT(epoch, cur->epoch)
@@ -747,8 +750,12 @@ int Dtls13RtxAddAck(WOLFSSL* ssl, w64wrapper epoch, w64wrapper seq)
747750
}
748751

749752
rn = Dtls13NewRecordNumber(epoch, seq, ssl->heap);
750-
if (rn == NULL)
753+
if (rn == NULL) {
754+
#ifdef WOLFSSL_RW_THREADED
755+
wc_UnLockMutex(&ssl->dtls13Rtx.mutex);
756+
#endif
751757
return MEMORY_E;
758+
}
752759

753760
*prevNext = rn;
754761
rn->next = cur;

0 commit comments

Comments
 (0)