run allocation tool on ocsp and check for mallocs

This commit is contained in:
Jacob Barthelmeh
2016-06-09 12:03:28 -06:00
parent 8be5409bc5
commit 7943f68f2a
3 changed files with 11 additions and 7 deletions

View File

@@ -976,12 +976,13 @@ int EmbedOcspLookup(void* ctx, const char* url, int urlSz,
}
/* in default callback ctx is heap hint */
void EmbedOcspRespFree(void* ctx, byte *resp)
{
(void)ctx;
if (resp)
XFREE(resp, NULL, DYNAMIC_TYPE_OCSP);
XFREE(resp, ctx, DYNAMIC_TYPE_OCSP);
(void)ctx;
}

View File

@@ -71,7 +71,7 @@ static int InitOcspEntry(OcspEntry* entry, OcspRequest* request)
}
static void FreeOcspEntry(OcspEntry* entry)
static void FreeOcspEntry(OcspEntry* entry, void* heap)
{
CertStatus *status, *next;
@@ -81,10 +81,12 @@ static void FreeOcspEntry(OcspEntry* entry)
next = status->next;
if (status->rawOcspResponse)
XFREE(status->rawOcspResponse, NULL, DYNAMIC_TYPE_OCSP_STATUS);
XFREE(status->rawOcspResponse, heap, DYNAMIC_TYPE_OCSP_STATUS);
XFREE(status, NULL, DYNAMIC_TYPE_OCSP_STATUS);
XFREE(status, heap, DYNAMIC_TYPE_OCSP_STATUS);
}
(void)heap;
}
@@ -96,7 +98,7 @@ void FreeOCSP(WOLFSSL_OCSP* ocsp, int dynamic)
for (entry = ocsp->ocspList; entry; entry = next) {
next = entry->next;
FreeOcspEntry(entry);
FreeOcspEntry(entry, ocsp->cm->heap);
XFREE(entry, ocsp->cm->heap, DYNAMIC_TYPE_OCSP_ENTRY);
}

View File

@@ -4471,6 +4471,7 @@ int wolfSSL_CertManagerEnableOCSPStapling(WOLFSSL_CERT_MANAGER* cm)
#ifndef WOLFSSL_USER_IO
cm->ocspIOCb = EmbedOcspLookup;
cm->ocspRespFreeCb = EmbedOcspRespFree;
cm->ocspIOCtx = cm->heap;
#endif /* WOLFSSL_USER_IO */
#else
ret = NOT_COMPILED_IN;