Fix infinite loop bug
diff --git a/src/Encrypt.c b/src/Encrypt.c
index e83b441..e74c077 100644
--- a/src/Encrypt.c
+++ b/src/Encrypt.c
@@ -120,7 +120,7 @@
if (p->pbKey != NULL) COSE_FREE(p ->pbKey, &p->m_message.m_allocContext);
for (pRecipient1 = p->m_recipientFirst; pRecipient1 != NULL; pRecipient1 = pRecipient2) {
- pRecipient2 = pRecipient1;
+ pRecipient2 = pRecipient1->m_recipientNext;
COSE_Recipient_Free((HCOSE_RECIPIENT)pRecipient1);
}
diff --git a/src/Recipient.c b/src/Recipient.c
index 83209a7..9d59202 100644
--- a/src/Recipient.c
+++ b/src/Recipient.c
@@ -69,6 +69,7 @@
}
p = p->m_recipientNext;
}
+ if (p != NULL) p->m_encrypt.m_message.m_refCount++;
return (HCOSE_RECIPIENT)p;
}