From 8f586f5bc10f86a064c74f06542b9da6cf137cc6 Mon Sep 17 00:00:00 2001 From: Pauli Date: Wed, 17 Mar 2021 13:05:37 +1000 Subject: [PATCH] test: coverity 1455749 - dereference after null check Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/14589) --- test/evp_test.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/evp_test.c b/test/evp_test.c index 0c81939f2e4..2bb837e6e70 100644 --- a/test/evp_test.c +++ b/test/evp_test.c @@ -1460,15 +1460,16 @@ static void pkey_test_cleanup(EVP_TEST *t) static int pkey_test_ctrl(EVP_TEST *t, EVP_PKEY_CTX *pctx, const char *value) { - int rv; + int rv = 0; char *p, *tmpval; if (!TEST_ptr(tmpval = OPENSSL_strdup(value))) return 0; p = strchr(tmpval, ':'); - if (p != NULL) + if (p != NULL) { *p++ = '\0'; - rv = EVP_PKEY_CTX_ctrl_str(pctx, tmpval, p); + rv = EVP_PKEY_CTX_ctrl_str(pctx, tmpval, p); + } if (rv == -2) { t->err = "PKEY_CTRL_INVALID"; rv = 1; -- 2.47.2