BUG/MINOR: ssl: Missing calloc return value check in ssl_init_single_engine
A memory allocation failure happening during ssl_init_single_engine
would have resulted in a crash. This function is only called during
init.
It was raised in GitHub issue #1233.
It could be backported to all stable branches.
(cherry picked from commit 612b2c37be70636e73698c6c064af9522301be65)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 46697c80fec88e656a4f7280a2cfa9dedbfb33a5)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit e10ab28ffdedb731f17ce1465def365c2cbeaa74)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 740fbaa874d43833c8d99fab2c4b9ee61d7b46cd)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index a05eb11..e82874c 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -489,6 +489,8 @@
}
el = calloc(1, sizeof(*el));
+ if (!el)
+ goto fail_alloc;
el->e = engine;
LIST_ADD(&openssl_engines, &el->list);
nb_engines++;
@@ -496,6 +498,7 @@
global.ssl_used_async_engines = nb_engines;
return 0;
+fail_alloc:
fail_set_method:
/* release the functional reference from ENGINE_init() */
ENGINE_finish(engine);