Skip to content

Commit

Permalink
fixup! ocsp: don't free ocsp request if saved in ssl->ctx->certOcspRe…
Browse files Browse the repository at this point in the history
…quest
  • Loading branch information
rizlik committed Jul 29, 2024
1 parent a1fbfa9 commit 31380ac
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -23311,14 +23311,16 @@ int SendFinished(WOLFSSL* ssl)
*/
static int CreateOcspRequest(WOLFSSL* ssl, OcspRequest* request,
DecodedCert* cert, byte* certData, word32 length,
byte *takeOwnership)
byte *ctxOwnsRequest)
{
byte ctxOwnsRequest = 0;
int ret;

if (request != NULL)
XMEMSET(request, 0, sizeof(OcspRequest));

if (ctxOwnsRequest!= NULL)
*ctxOwnsRequest = 0;

InitDecodedCert(cert, certData, length, ssl->heap);
/* TODO: Setup async support here */
ret = ParseCertRelative(cert, CERT_TYPE, VERIFY, SSL_CM(ssl), NULL);
Expand All @@ -23334,16 +23336,15 @@ static int CreateOcspRequest(WOLFSSL* ssl, OcspRequest* request,
if (wc_LockMutex(ocspLock) == 0) {
if (ssl->ctx->certOcspRequest == NULL) {
ssl->ctx->certOcspRequest = request;
ctxOwnsRequest = 1;
if (ctxOwnsRequest!= NULL)
*ctxOwnsRequest = 1;
}
wc_UnLockMutex(ocspLock);
}
}
}

FreeDecodedCert(cert);
if (takeOwnership != NULL)
*takeOwnership = ctxOwnsRequest;

return ret;
}
Expand Down

0 comments on commit 31380ac

Please sign in to comment.