ocsp: fix memory leaks in OpenSSL compat layer

pull/8408/head
Marco Oliverio 2025-02-01 01:04:52 +00:00
parent 79744a7736
commit dedbb2526c
2 changed files with 10 additions and 3 deletions

View File

@ -917,12 +917,17 @@ out:
void wolfSSL_OCSP_RESPONSE_free(OcspResponse* response)
{
OcspEntry *s, *sNext;
if (response == NULL)
return;
if (response->single != NULL) {
FreeOcspEntry(response->single, NULL);
XFREE(response->single, NULL, DYNAMIC_TYPE_OCSP_ENTRY);
s = response->single;
while (s != NULL) {
sNext = s->next;
FreeOcspEntry(s, NULL);
XFREE(s, NULL, DYNAMIC_TYPE_OCSP_ENTRY);
s = sNext;
}
XFREE(response->source, NULL, DYNAMIC_TYPE_TMP_BUFFER);

View File

@ -36967,6 +36967,7 @@ static int DecodeResponseData(byte* source, word32* ioIndex,
XMEMSET(single->next->status, 0, sizeof(CertStatus));
single->next->isDynamic = 1;
single->next->ownStatus = 1;
single = single->next;
}
@ -37056,6 +37057,7 @@ static int DecodeResponseData(byte* source, word32* ioIndex,
/* Entry to be freed. */
single->next->isDynamic = 1;
single->next->ownStatus = 1;
/* used will be 0 (false) */
single = single->next;