static OSSL_PROVIDER *provider_new(const char *name,
                                   OSSL_provider_init_fn *init_function)
{
    OSSL_PROVIDER *prov = NULL;
    if ((prov = OPENSSL_zalloc(sizeof(*prov))) == NULL
#ifndef HAVE_ATOMICS
        || (prov->refcnt_lock = CRYPTO_THREAD_lock_new()) == NULL
#endif
        || !ossl_provider_upref(prov)
        || (prov->name = OPENSSL_strdup(name)) == NULL) {
        ossl_provider_free(prov);
        CRYPTOerr(CRYPTO_F_PROVIDER_NEW, ERR_R_MALLOC_FAILURE);
        return NULL;
    }
    prov->init_function = init_function;
    return prov;
}
['static OSSL_PROVIDER *provider_new(const char *name,\n                                   OSSL_provider_init_fn *init_function)\n{\n    OSSL_PROVIDER *prov = NULL;\n    if ((prov = OPENSSL_zalloc(sizeof(*prov))) == NULL\n#ifndef HAVE_ATOMICS\n        || (prov->refcnt_lock = CRYPTO_THREAD_lock_new()) == NULL\n#endif\n        || !ossl_provider_upref(prov)\n        || (prov->name = OPENSSL_strdup(name)) == NULL) {\n        ossl_provider_free(prov);\n        CRYPTOerr(CRYPTO_F_PROVIDER_NEW, ERR_R_MALLOC_FAILURE);\n        return NULL;\n    }\n    prov->init_function = init_function;\n    return prov;\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    FAILTEST();\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    INCREMENT(malloc_count);\n    if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)\n        return malloc_impl(num, file, line);\n    if (num == 0)\n        return NULL;\n    FAILTEST();\n    if (allow_customize) {\n        allow_customize = 0;\n    }\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    (void)(file); (void)(line);\n    ret = malloc(num);\n#endif\n    return ret;\n}', 'int ossl_provider_upref(OSSL_PROVIDER *prov)\n{\n    int ref = 0;\n    CRYPTO_UP_REF(&prov->refcnt, &ref, prov->refcnt_lock);\n    return ref;\n}', 'static inline int CRYPTO_UP_REF(_Atomic int *val, int *ret, void *lock)\n{\n    *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1;\n    return 1;\n}', 'char *CRYPTO_strdup(const char *str, const char* file, int line)\n{\n    char *ret;\n    if (str == NULL)\n        return NULL;\n    ret = CRYPTO_malloc(strlen(str) + 1, file, line);\n    if (ret != NULL)\n        strcpy(ret, str);\n    return ret;\n}']