apps/x509.c:998: error: NULL_DEREFERENCE
  pointer `upkey` last assigned on line 997 could be null and is dereferenced by call to `EVP_PKEY_copy_parameters()` at line 998, column 5.
Showing all 10 steps of the trace


apps/x509.c:985:1: start of procedure x509_certify()
983.   }
984.   
985. > static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
986.                           X509 *x, X509 *xca, EVP_PKEY *pkey,
987.                           STACK_OF(OPENSSL_STRING) *sigopts,

apps/x509.c:992:5: 
990.                           ASN1_INTEGER *sno, int reqfile)
991.   {
992. >     int ret = 0;
993.       ASN1_INTEGER *bs = NULL;
994.       X509_STORE_CTX xsc;

apps/x509.c:993:5: 
991.   {
992.       int ret = 0;
993. >     ASN1_INTEGER *bs = NULL;
994.       X509_STORE_CTX xsc;
995.       EVP_PKEY *upkey;

apps/x509.c:997:5: 
995.       EVP_PKEY *upkey;
996.   
997. >     upkey = X509_get_pubkey(xca);
998.       EVP_PKEY_copy_parameters(upkey, pkey);
999.       EVP_PKEY_free(upkey);

crypto/x509/x509_cmp.c:307:1: start of procedure X509_get_pubkey()
  305.   }
  306.   
  307. > EVP_PKEY *X509_get_pubkey(X509 *x)
  308.   {
  309.       if ((x == NULL) || (x->cert_info == NULL))

crypto/x509/x509_cmp.c:309:10: Taking false branch
  307.   EVP_PKEY *X509_get_pubkey(X509 *x)
  308.   {
  309.       if ((x == NULL) || (x->cert_info == NULL))
                  ^
  310.           return (NULL);
  311.       return (X509_PUBKEY_get(x->cert_info->key));

crypto/x509/x509_cmp.c:309:25: Taking true branch
  307.   EVP_PKEY *X509_get_pubkey(X509 *x)
  308.   {
  309.       if ((x == NULL) || (x->cert_info == NULL))
                                 ^
  310.           return (NULL);
  311.       return (X509_PUBKEY_get(x->cert_info->key));

crypto/x509/x509_cmp.c:310:9: 
  308.   {
  309.       if ((x == NULL) || (x->cert_info == NULL))
  310. >         return (NULL);
  311.       return (X509_PUBKEY_get(x->cert_info->key));
  312.   }

crypto/x509/x509_cmp.c:312:1: return from a call to X509_get_pubkey
  310.           return (NULL);
  311.       return (X509_PUBKEY_get(x->cert_info->key));
  312. > }
  313.   
  314.   ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x)

apps/x509.c:998:5: 
996.   
997.       upkey = X509_get_pubkey(xca);
998. >     EVP_PKEY_copy_parameters(upkey, pkey);
999.       EVP_PKEY_free(upkey);
1000.   
