test: check for NULL returns better

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/15910)
This commit is contained in:
Pauli 2021-06-25 12:57:53 +10:00
parent 711d5a2fc0
commit f06c554760
2 changed files with 6 additions and 2 deletions

View File

@ -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)

View File

@ -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;