ssl/s3_srvr.c:2209: error: NULL_DEREFERENCE
  pointer `clnt_pub_pkey` last assigned on line 1683 could be null and is dereferenced by call to `EVP_PKEY_free()` at line 2209, column 2.
Showing all 38 steps of the trace


ssl/s3_srvr.c:1663:1: start of procedure ssl3_get_client_key_exchange()
1661.   #endif	/* OPENSSL_NO_ECDH */
1662.   
1663. > int ssl3_get_client_key_exchange(SSL *s)
1664.   	{
1665.   	int i,al,ok;

ssl/s3_srvr.c:1670:2: 
1668.   	unsigned char *p;
1669.   #ifndef OPENSSL_NO_RSA
1670. > 	RSA *rsa=NULL;
1671.   	EVP_PKEY *pkey=NULL;
1672.   #endif

ssl/s3_srvr.c:1671:2: 
1669.   #ifndef OPENSSL_NO_RSA
1670.   	RSA *rsa=NULL;
1671. > 	EVP_PKEY *pkey=NULL;
1672.   #endif
1673.   #ifndef OPENSSL_NO_DH

ssl/s3_srvr.c:1674:2: 
1672.   #endif
1673.   #ifndef OPENSSL_NO_DH
1674. > 	BIGNUM *pub=NULL;
1675.   	DH *dh_srvr;
1676.   #endif

ssl/s3_srvr.c:1682:2: 
1680.   
1681.   #ifndef OPENSSL_NO_ECDH
1682. > 	EC_KEY *srvr_ecdh = NULL;
1683.   	EVP_PKEY *clnt_pub_pkey = NULL;
1684.   	EC_POINT *clnt_ecpoint = NULL;

ssl/s3_srvr.c:1683:2: 
1681.   #ifndef OPENSSL_NO_ECDH
1682.   	EC_KEY *srvr_ecdh = NULL;
1683. > 	EVP_PKEY *clnt_pub_pkey = NULL;
1684.   	EC_POINT *clnt_ecpoint = NULL;
1685.   	BN_CTX *bn_ctx = NULL; 

ssl/s3_srvr.c:1684:2: 
1682.   	EC_KEY *srvr_ecdh = NULL;
1683.   	EVP_PKEY *clnt_pub_pkey = NULL;
1684. > 	EC_POINT *clnt_ecpoint = NULL;
1685.   	BN_CTX *bn_ctx = NULL; 
1686.   #endif

ssl/s3_srvr.c:1685:2: 
1683.   	EVP_PKEY *clnt_pub_pkey = NULL;
1684.   	EC_POINT *clnt_ecpoint = NULL;
1685. > 	BN_CTX *bn_ctx = NULL; 
1686.   #endif
1687.   

ssl/s3_srvr.c:1688:2: Skipping __function_pointer__(): unresolved function pointer
1686.   #endif
1687.   
1688.   	n=s->method->ssl_get_message(s,
         ^
1689.   		SSL3_ST_SR_KEY_EXCH_A,
1690.   		SSL3_ST_SR_KEY_EXCH_B,

ssl/s3_srvr.c:1695:7: Taking false branch
1693.   		&ok);
1694.   
1695.   	if (!ok) return((int)n);
              ^
1696.   	p=(unsigned char *)s->init_msg;
1697.   

ssl/s3_srvr.c:1696:2: 
1694.   
1695.   	if (!ok) return((int)n);
1696. > 	p=(unsigned char *)s->init_msg;
1697.   
1698.   	l=s->s3->tmp.new_cipher->algorithms;

ssl/s3_srvr.c:1698:2: 
1696.   	p=(unsigned char *)s->init_msg;
1697.   
1698. > 	l=s->s3->tmp.new_cipher->algorithms;
1699.   
1700.   #ifndef OPENSSL_NO_RSA

ssl/s3_srvr.c:1701:6: Taking true branch
1699.   
1700.   #ifndef OPENSSL_NO_RSA
1701.   	if (l & SSL_kRSA)
             ^
1702.   		{
1703.   		/* FIX THIS UP EAY EAY EAY EAY */

ssl/s3_srvr.c:1704:7: Taking false branch
1702.   		{
1703.   		/* FIX THIS UP EAY EAY EAY EAY */
1704.   		if (s->s3->tmp.use_rsa_tmp)
              ^
1705.   			{
1706.   			if ((s->cert != NULL) && (s->cert->rsa_tmp != NULL))

ssl/s3_srvr.c:1720:4: 
1718.   		else
1719.   			{
1720. > 			pkey=s->cert->pkeys[SSL_PKEY_RSA_ENC].privatekey;
1721.   			if (	(pkey == NULL) ||
1722.   				(pkey->type != EVP_PKEY_RSA) ||

ssl/s3_srvr.c:1721:10: Taking false branch
1719.   			{
1720.   			pkey=s->cert->pkeys[SSL_PKEY_RSA_ENC].privatekey;
1721.   			if (	(pkey == NULL) ||
                 ^
1722.   				(pkey->type != EVP_PKEY_RSA) ||
1723.   				(pkey->pkey.rsa == NULL))

ssl/s3_srvr.c:1722:6: Taking false branch
1720.   			pkey=s->cert->pkeys[SSL_PKEY_RSA_ENC].privatekey;
1721.   			if (	(pkey == NULL) ||
1722.   				(pkey->type != EVP_PKEY_RSA) ||
             ^
1723.   				(pkey->pkey.rsa == NULL))
1724.   				{

ssl/s3_srvr.c:1723:6: Taking false branch
1721.   			if (	(pkey == NULL) ||
1722.   				(pkey->type != EVP_PKEY_RSA) ||
1723.   				(pkey->pkey.rsa == NULL))
             ^
1724.   				{
1725.   				al=SSL_AD_HANDSHAKE_FAILURE;

ssl/s3_srvr.c:1729:4: 
1727.   				goto f_err;
1728.   				}
1729. > 			rsa=pkey->pkey.rsa;
1730.   			}
1731.   

ssl/s3_srvr.c:1733:7: Taking true branch
1731.   
1732.   		/* TLS */
1733.   		if (s->version > SSL3_VERSION)
              ^
1734.   			{
1735.   			n2s(p,i);

ssl/s3_srvr.c:1735:4: 
1733.   		if (s->version > SSL3_VERSION)
1734.   			{
1735. > 			n2s(p,i);
1736.   			if (n != i+2)
1737.   				{

ssl/s3_srvr.c:1736:8: Taking true branch
1734.   			{
1735.   			n2s(p,i);
1736.   			if (n != i+2)
               ^
1737.   				{
1738.   				if (!(s->options & SSL_OP_TLS_D5_BUG))

ssl/s3_srvr.c:1738:11: Taking true branch
1736.   			if (n != i+2)
1737.   				{
1738.   				if (!(s->options & SSL_OP_TLS_D5_BUG))
                  ^
1739.   					{
1740.   					SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG);

ssl/s3_srvr.c:1740:6: 
1738.   				if (!(s->options & SSL_OP_TLS_D5_BUG))
1739.   					{
1740. > 					SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG);
1741.   					goto err;
1742.   					}

crypto/err/err.c:666:1: start of procedure ERR_put_error()
  664.   /********************************************************/
  665.   
  666. > void ERR_put_error(int lib, int func, int reason, const char *file,
  667.   	     int line)
  668.   	{

crypto/err/err.c:690:2: Skipping ERR_get_state(): empty list of specs
  688.   	}
  689.   #endif
  690.   	es=ERR_get_state();
          ^
  691.   
  692.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:692:2: 
  690.   	es=ERR_get_state();
  691.   
  692. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
  693.   	if (es->top == es->bottom)
  694.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:693:6: Taking false branch
  691.   
  692.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
  693.   	if (es->top == es->bottom)
              ^
  694.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
  695.   	es->err_flags[es->top]=0;

crypto/err/err.c:695:2: 
  693.   	if (es->top == es->bottom)
  694.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
  695. > 	es->err_flags[es->top]=0;
  696.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
  697.   	es->err_file[es->top]=file;

crypto/err/err.c:696:2: 
  694.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
  695.   	es->err_flags[es->top]=0;
  696. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
  697.   	es->err_file[es->top]=file;
  698.   	es->err_line[es->top]=line;

crypto/err/err.c:697:2: 
  695.   	es->err_flags[es->top]=0;
  696.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
  697. > 	es->err_file[es->top]=file;
  698.   	es->err_line[es->top]=line;
  699.   	err_clear_data(es,es->top);

crypto/err/err.c:698:2: 
  696.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
  697.   	es->err_file[es->top]=file;
  698. > 	es->err_line[es->top]=line;
  699.   	err_clear_data(es,es->top);
  700.   	}

crypto/err/err.c:699:2: Taking true branch
  697.   	es->err_file[es->top]=file;
  698.   	es->err_line[es->top]=line;
  699.   	err_clear_data(es,es->top);
          ^
  700.   	}
  701.   

crypto/err/err.c:699:2: Taking false branch
  697.   	es->err_file[es->top]=file;
  698.   	es->err_line[es->top]=line;
  699.   	err_clear_data(es,es->top);
          ^
  700.   	}
  701.   

crypto/err/err.c:699:2: Loop condition is false. Leaving loop
  697.   	es->err_file[es->top]=file;
  698.   	es->err_line[es->top]=line;
  699.   	err_clear_data(es,es->top);
          ^
  700.   	}
  701.   

crypto/err/err.c:700:2: return from a call to ERR_put_error
  698.   	es->err_line[es->top]=line;
  699.   	err_clear_data(es,es->top);
  700.   	}
          ^
  701.   
  702.   void ERR_clear_error(void)

ssl/s3_srvr.c:2206:1: 
2204.   	ssl3_send_alert(s,SSL3_AL_FATAL,al);
2205.   #if !defined(OPENSSL_NO_DH) || !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_ECDH)
2206. > err:
2207.   #endif
2208.   #ifndef OPENSSL_NO_ECDH

ssl/s3_srvr.c:2209:2: 
2207.   #endif
2208.   #ifndef OPENSSL_NO_ECDH
2209. > 	EVP_PKEY_free(clnt_pub_pkey);
2210.   	EC_POINT_free(clnt_ecpoint);
2211.   	if (srvr_ecdh != NULL) 
