diff --git a/src/ssl_sock.c b/src/ssl_sock.c index ec271c922..f596a831d 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -636,6 +636,8 @@ int ssl_init_single_engine(const char *engine_id, const char *def_algorithms) } el = calloc(1, sizeof(*el)); + if (!el) + goto fail_alloc; el->e = engine; LIST_INSERT(&openssl_engines, &el->list); nb_engines++; @@ -643,6 +645,7 @@ int ssl_init_single_engine(const char *engine_id, const char *def_algorithms) global.ssl_used_async_engines = nb_engines; return 0; +fail_alloc: fail_set_method: /* release the functional reference from ENGINE_init() */ ENGINE_finish(engine);