From: Pauli Date: Wed, 17 Mar 2021 03:05:37 +0000 (+1000) Subject: test: coverity 1455749 - dereference after null check X-Git-Tag: openssl-3.0.0-alpha14~181 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f586f5bc10f86a064c74f06542b9da6cf137cc6;p=thirdparty%2Fopenssl.git test: coverity 1455749 - dereference after null check Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/14589) --- 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;