From c87d6b27e25a2404caa625c4cb90510066203bad Mon Sep 17 00:00:00 2001 From: John Safranek Date: Wed, 1 Aug 2018 15:26:31 -0700 Subject: [PATCH] OCSP Free Free the OCSP request when creating the response only if there is an error making the request. --- src/internal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/internal.c b/src/internal.c index 0ffaae6c4..4590e596d 100644 --- a/src/internal.c +++ b/src/internal.c @@ -14048,8 +14048,10 @@ int CreateOcspResponse(WOLFSSL* ssl, OcspRequest** ocspRequest, der->length); } - if (request != NULL) + if (request != NULL && ret != 0) { XFREE(request, ssl->heap, DYNAMIC_TYPE_OCSP_REQUEST); + request = NULL; + } #ifdef WOLFSSL_SMALL_STACK XFREE(cert, ssl->heap, DYNAMIC_TYPE_DCERT); #endif