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 <jiasheng@iscas.ac.cn>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Yang <kaishen.yy@antfin.com>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/18552)
This commit is contained in:
Jiasheng Jiang 2022-06-14 15:06:23 +08:00 committed by Todd Short
parent 115eb945ac
commit 4f4942a133

View File

@ -1741,6 +1741,8 @@ int main(int argc, char *argv[])
/* Use a fixed key so that we can decrypt the ticket. */ /* Use a fixed key so that we can decrypt the ticket. */
size = SSL_CTX_set_tlsext_ticket_keys(s_ctx, NULL, 0); size = SSL_CTX_set_tlsext_ticket_keys(s_ctx, NULL, 0);
keys = OPENSSL_zalloc(size); keys = OPENSSL_zalloc(size);
if (keys == NULL)
goto end;
SSL_CTX_set_tlsext_ticket_keys(s_ctx, keys, size); SSL_CTX_set_tlsext_ticket_keys(s_ctx, keys, size);
OPENSSL_free(keys); OPENSSL_free(keys);
} }