From: Pauli Date: Fri, 25 Jun 2021 02:57:53 +0000 (+1000) Subject: test: check for NULL returns better X-Git-Tag: openssl-3.0.0-beta2~183 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f06c5547605b1e400f95eafb77a42947e4d50b78;p=thirdparty%2Fopenssl.git test: check for NULL returns better Reviewed-by: Shane Lontis (Merged from https://github.com/openssl/openssl/pull/15910) --- diff --git a/test/hmactest.c b/test/hmactest.c index 7cb7fb635ce..63954a1183c 100644 --- a/test/hmactest.c +++ b/test/hmactest.c @@ -132,7 +132,8 @@ static int test_hmac_run(void) unsigned int len; int ret = 0; - ctx = HMAC_CTX_new(); + if (!TEST_ptr(ctx = HMAC_CTX_new())) + return 0; HMAC_CTX_reset(ctx); if (!TEST_ptr(ctx) diff --git a/test/params_test.c b/test/params_test.c index 205c2deab05..13cfb9d19ec 100644 --- a/test/params_test.c +++ b/test/params_test.c @@ -97,7 +97,10 @@ static void cleanup_object(void *vobj) static void *init_object(void) { - struct object_st *obj = OPENSSL_zalloc(sizeof(*obj)); + struct object_st *obj; + + if (!TEST_ptr(obj = OPENSSL_zalloc(sizeof(*obj)))) + return NULL; obj->p1 = p1_init; obj->p2 = p2_init;