exdata_done = 1;
if (!ossl_crypto_new_ex_data_ex(ctx, CRYPTO_EX_INDEX_OSSL_LIB_CTX, NULL,
- &ctx->data)) {
- ossl_crypto_cleanup_all_ex_data_int(ctx);
+ &ctx->data))
goto err;
- }
/* Everything depends on properties, so we also pre-initialise that */
if (!ossl_property_parse_init(ctx))
err:
if (exdata_done)
ossl_crypto_cleanup_all_ex_data_int(ctx);
+ for (i = 0; i < OSSL_LIB_CTX_MAX_INDEXES; i++)
+ CRYPTO_THREAD_lock_free(ctx->index_locks[i]);
CRYPTO_THREAD_lock_free(ctx->oncelock);
CRYPTO_THREAD_lock_free(ctx->lock);
- ctx->lock = NULL;
+ memset(ctx, '\0', sizeof(*ctx));
return 0;
}
OSSL_LIB_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
if (ctx != NULL && !context_init(ctx)) {
- OSSL_LIB_CTX_free(ctx);
+ OPENSSL_free(ctx);
ctx = NULL;
}
return ctx;