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


apps/x509.c:1313:1: start of procedure sign()
1311.   
1312.   /* self sign */
1313. > static int sign(X509 *x, EVP_PKEY *pkey, int days, int clrext, const EVP_MD *digest, 
1314.   						CONF *conf, char *section)
1315.   	{

apps/x509.c:1319:2: 
1317.   	EVP_PKEY *pktmp;
1318.   
1319. > 	pktmp = X509_get_pubkey(x);
1320.   	EVP_PKEY_copy_parameters(pktmp,pkey);
1321.   	EVP_PKEY_save_parameters(pktmp,1);

crypto/x509/x509_cmp.c:300:1: start of procedure X509_get_pubkey()
  298.   	}
  299.   
  300. > EVP_PKEY *X509_get_pubkey(X509 *x)
  301.   	{
  302.   	if ((x == NULL) || (x->cert_info == NULL))

crypto/x509/x509_cmp.c:302:7: Taking false branch
  300.   EVP_PKEY *X509_get_pubkey(X509 *x)
  301.   	{
  302.   	if ((x == NULL) || (x->cert_info == NULL))
               ^
  303.   		return(NULL);
  304.   	return(X509_PUBKEY_get(x->cert_info->key));

crypto/x509/x509_cmp.c:302:22: Taking true branch
  300.   EVP_PKEY *X509_get_pubkey(X509 *x)
  301.   	{
  302.   	if ((x == NULL) || (x->cert_info == NULL))
                              ^
  303.   		return(NULL);
  304.   	return(X509_PUBKEY_get(x->cert_info->key));

crypto/x509/x509_cmp.c:303:3: 
  301.   	{
  302.   	if ((x == NULL) || (x->cert_info == NULL))
  303. > 		return(NULL);
  304.   	return(X509_PUBKEY_get(x->cert_info->key));
  305.   	}

crypto/x509/x509_cmp.c:305:2: return from a call to X509_get_pubkey
  303.   		return(NULL);
  304.   	return(X509_PUBKEY_get(x->cert_info->key));
  305.   	}
          ^
  306.   
  307.   ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x)

apps/x509.c:1320:2: 
1318.   
1319.   	pktmp = X509_get_pubkey(x);
1320. > 	EVP_PKEY_copy_parameters(pktmp,pkey);
1321.   	EVP_PKEY_save_parameters(pktmp,1);
1322.   	EVP_PKEY_free(pktmp);
