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


apps/x509.c:1205:1: start of procedure sign()
1203.   
1204.   /* self sign */
1205. > static int sign(X509 *x, EVP_PKEY *pkey, int days, int clrext,
1206.                   const EVP_MD *digest, CONF *conf, char *section)
1207.   {

apps/x509.c:1211:5: 
1209.       EVP_PKEY *pktmp;
1210.   
1211. >     pktmp = X509_get_pubkey(x);
1212.       EVP_PKEY_copy_parameters(pktmp, pkey);
1213.       EVP_PKEY_save_parameters(pktmp, 1);

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

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

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

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

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

apps/x509.c:1212:5: 
1210.   
1211.       pktmp = X509_get_pubkey(x);
1212. >     EVP_PKEY_copy_parameters(pktmp, pkey);
1213.       EVP_PKEY_save_parameters(pktmp, 1);
1214.       EVP_PKEY_free(pktmp);
