From: xkernel Date: Mon, 11 Jul 2022 07:12:00 +0000 (+0800) Subject: ocspapitest: properly check the return of memory-allocating functions X-Git-Tag: openssl-3.2.0-alpha1~2387 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea809510f69e5aebc2ab95aa7530e01060e8a960;p=thirdparty%2Fopenssl.git ocspapitest: properly check the return of memory-allocating functions Reviewed-by: Paul Dale Reviewed-by: Kurt Roeckx Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/18774) --- diff --git a/test/ocspapitest.c b/test/ocspapitest.c index 9e8c3062599..7142f50831e 100644 --- a/test/ocspapitest.c +++ b/test/ocspapitest.c @@ -78,7 +78,10 @@ static OCSP_BASICRESP *make_dummy_resp(void) ASN1_BIT_STRING *key = ASN1_BIT_STRING_new(); ASN1_INTEGER *serial = ASN1_INTEGER_new(); - if (!X509_NAME_add_entry_by_NID(name, NID_commonName, MBSTRING_ASC, + if (!TEST_ptr(name) + || !TEST_ptr(key) + || !TEST_ptr(serial) + || !X509_NAME_add_entry_by_NID(name, NID_commonName, MBSTRING_ASC, namestr, -1, -1, 1) || !ASN1_BIT_STRING_set(key, keybytes, sizeof(keybytes)) || !ASN1_INTEGER_set_uint64(serial, (uint64_t)1))