src/wolfSSL/src/internal.c
void SSL_CtxResourceFree(WOLFSSL_CTX* ctx)
{
    int i;

    (void)i;

    XFREE(ctx->method, ctx->heap, DYNAMIC_TYPE_METHOD);
    if (ctx->suites)
        XFREE(ctx->suites, ctx->heap, DYNAMIC_TYPE_SUITES);

#ifndef NO_DH
    XFREE(ctx->serverDH_G.buffer, ctx->heap, DYNAMIC_TYPE_DH);
    XFREE(ctx->serverDH_P.buffer, ctx->heap, DYNAMIC_TYPE_DH);
#endif

#ifndef NO_CERTS
    FreeDer(&ctx->privateKey);
    FreeDer(&ctx->certificate);
    FreeDer(&ctx->certChain);
    wolfSSL_CertManagerFree(ctx->cm);
#endif

#ifdef HAVE_TLS_EXTENSIONS
    TLSX_FreeAll(ctx->extensions);

#ifndef NO_WOLFSSL_SERVER

#if defined(HAVE_CERTIFICATE_STATUS_REQUEST) \
 || defined(HAVE_CERTIFICATE_STATUS_REQUEST_V2)
    if (ctx->certOcspRequest) {
        FreeOcspRequest(ctx->certOcspRequest);
        XFREE(ctx->certOcspRequest, NULL, DYNAMIC_TYPE_OCSP_REQUEST);
    }
#endif

#if defined(HAVE_CERTIFICATE_STATUS_REQUEST_V2)
    for (i = 0; i < MAX_CHAIN_DEPTH; i++) {
        if (ctx->chainOcspRequest[i]) {
            FreeOcspRequest(ctx->chainOcspRequest[i]);
            XFREE(ctx->chainOcspRequest[i], NULL, DYNAMIC_TYPE_OCSP_REQUEST);
        }
    }
#endif

#endif /* NO_WOLFSSL_SERVER */

#endif /* HAVE_TLS_EXTENSIONS */
}
/* In case contexts are held in array and don't want to free actual ctx */
In case contexts are held in array and don't want to free actual ctx
In case contexts are held in array and don ' t want to free actual ctx
void SSL_CtxResourceFree(WOLFSSL_CTX* ctx)
{
    int i;
    (void)i;
    XFREE(ctx->method, ctx->heap, DYNAMIC_TYPE_METHOD);
    if (ctx->suites)
        XFREE(ctx->suites, ctx->heap, DYNAMIC_TYPE_SUITES);
#ifndef NO_DH
    XFREE(ctx->serverDH_G.buffer, ctx->heap, DYNAMIC_TYPE_DH);
    XFREE(ctx->serverDH_P.buffer, ctx->heap, DYNAMIC_TYPE_DH);
#endif
#ifndef NO_CERTS
    FreeDer(&ctx->privateKey);
    FreeDer(&ctx->certificate);
    FreeDer(&ctx->certChain);
    wolfSSL_CertManagerFree(ctx->cm);
#endif
#ifdef HAVE_TLS_EXTENSIONS
    TLSX_FreeAll(ctx->extensions);
#ifndef NO_WOLFSSL_SERVER
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST) \
 || defined(HAVE_CERTIFICATE_STATUS_REQUEST_V2)
    if (ctx->certOcspRequest) {
        FreeOcspRequest(ctx->certOcspRequest);
        XFREE(ctx->certOcspRequest, NULL, DYNAMIC_TYPE_OCSP_REQUEST);
    }
#endif
#if defined(HAVE_CERTIFICATE_STATUS_REQUEST_V2)
    for (i = 0; i < MAX_CHAIN_DEPTH; i++) {
        if (ctx->chainOcspRequest[i]) {
            FreeOcspRequest(ctx->chainOcspRequest[i]);
            XFREE(ctx->chainOcspRequest[i], NULL, DYNAMIC_TYPE_OCSP_REQUEST);
        }
    }
#endif
#endif 
#endif 
}
void SSL_CtxResourceFree ( WOLFSSL_CTX * ctx ) { int i ; ( void ) i ; XFREE ( ctx -> method , ctx -> heap , DYNAMIC_TYPE_METHOD ) ; if ( ctx -> suites ) XFREE ( ctx -> suites , ctx -> heap , DYNAMIC_TYPE_SUITES ) ; #ifndef NO_DH XFREE ( ctx -> serverDH_G . buffer , ctx -> heap , DYNAMIC_TYPE_DH ) ; XFREE ( ctx -> serverDH_P . buffer , ctx -> heap , DYNAMIC_TYPE_DH ) ; #endif #ifndef NO_CERTS FreeDer ( & ctx -> privateKey ) ; FreeDer ( & ctx -> certificate ) ; FreeDer ( & ctx -> certChain ) ; wolfSSL_CertManagerFree ( ctx -> cm ) ; #endif #ifdef HAVE_TLS_EXTENSIONS TLSX_FreeAll ( ctx -> extensions ) ; #ifndef NO_WOLFSSL_SERVER #if defined ( HAVE_CERTIFICATE_STATUS_REQUEST ) || defined ( HAVE_CERTIFICATE_STATUS_REQUEST_V2 ) if ( ctx -> certOcspRequest ) { FreeOcspRequest ( ctx -> certOcspRequest ) ; XFREE ( ctx -> certOcspRequest , NULL , DYNAMIC_TYPE_OCSP_REQUEST ) ; } #endif #if defined ( HAVE_CERTIFICATE_STATUS_REQUEST_V2 ) for ( i = 0 ; i < MAX_CHAIN_DEPTH ; i ++ ) { if ( ctx -> chainOcspRequest [ i ] ) { FreeOcspRequest ( ctx -> chainOcspRequest [ i ] ) ; XFREE ( ctx -> chainOcspRequest [ i ] , NULL , DYNAMIC_TYPE_OCSP_REQUEST ) ; } } #endif #endif #endif }
In case contexts are held in array and don't want to free actual ctx
In case contexts are held in array and don ' t want to free actual ctx
/* NO_WOLFSSL_SERVER */ /* HAVE_TLS_EXTENSIONS */