summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorxkernel <xkernel.wang@foxmail.com>2022-07-11 15:12:00 +0800
committerTomas Mraz <tomas@openssl.org>2022-07-14 14:08:51 +0200
commitea809510f69e5aebc2ab95aa7530e01060e8a960 (patch)
tree858e1ca58da392e3d52ef1464e89453f97ec82af /test
parent12186377cb987c4527d286e91e735e8261a45669 (diff)
ocspapitest: properly check the return of memory-allocating functions
Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18774)
Diffstat (limited to 'test')
-rw-r--r--test/ocspapitest.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/ocspapitest.c b/test/ocspapitest.c
index 9e8c306259..7142f50831 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))