From 4f4942a133bd57c4940fb1bc6ed7c8b67da4d8f0 Mon Sep 17 00:00:00 2001 From: Jiasheng Jiang Date: Tue, 14 Jun 2022 15:06:23 +0800 Subject: [PATCH] test/ssl_old_test.c: Add check for OPENSSL_zalloc As the potential failure of the OPENSSL_zalloc(), it should be better to add the check and return error if fails. Signed-off-by: Jiasheng Jiang Reviewed-by: Tomas Mraz Reviewed-by: Paul Yang Reviewed-by: Todd Short (Merged from https://github.com/openssl/openssl/pull/18552) --- test/ssl_old_test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/ssl_old_test.c b/test/ssl_old_test.c index 829f683a91b..b011534220e 100644 --- a/test/ssl_old_test.c +++ b/test/ssl_old_test.c @@ -1741,6 +1741,8 @@ int main(int argc, char *argv[]) /* Use a fixed key so that we can decrypt the ticket. */ size = SSL_CTX_set_tlsext_ticket_keys(s_ctx, NULL, 0); keys = OPENSSL_zalloc(size); + if (keys == NULL) + goto end; SSL_CTX_set_tlsext_ticket_keys(s_ctx, keys, size); OPENSSL_free(keys); } -- 2.47.2