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


ssl/s3_srvr.c:1602:1: start of procedure ssl3_get_client_key_exchange()
1600.   	}
1601.   
1602. > static int ssl3_get_client_key_exchange(SSL *s)
1603.   	{
1604.   	int i,al,ok;

ssl/s3_srvr.c:1609:2: 
1607.   	unsigned char *p;
1608.   #ifndef OPENSSL_NO_RSA
1609. > 	RSA *rsa=NULL;
1610.   	EVP_PKEY *pkey=NULL;
1611.   #endif

ssl/s3_srvr.c:1610:2: 
1608.   #ifndef OPENSSL_NO_RSA
1609.   	RSA *rsa=NULL;
1610. > 	EVP_PKEY *pkey=NULL;
1611.   #endif
1612.   #ifndef OPENSSL_NO_DH

ssl/s3_srvr.c:1613:2: 
1611.   #endif
1612.   #ifndef OPENSSL_NO_DH
1613. > 	BIGNUM *pub=NULL;
1614.   	DH *dh_srvr;
1615.   #endif

ssl/s3_srvr.c:1621:2: 
1619.   
1620.   #ifndef OPENSSL_NO_ECDH
1621. > 	EC_KEY *srvr_ecdh = NULL;
1622.   	EVP_PKEY *clnt_pub_pkey = NULL;
1623.   	EC_POINT *clnt_ecpoint = NULL;

ssl/s3_srvr.c:1622:2: 
1620.   #ifndef OPENSSL_NO_ECDH
1621.   	EC_KEY *srvr_ecdh = NULL;
1622. > 	EVP_PKEY *clnt_pub_pkey = NULL;
1623.   	EC_POINT *clnt_ecpoint = NULL;
1624.   	BN_CTX *bn_ctx = NULL; 

ssl/s3_srvr.c:1623:2: 
1621.   	EC_KEY *srvr_ecdh = NULL;
1622.   	EVP_PKEY *clnt_pub_pkey = NULL;
1623. > 	EC_POINT *clnt_ecpoint = NULL;
1624.   	BN_CTX *bn_ctx = NULL; 
1625.   #endif

ssl/s3_srvr.c:1624:2: 
1622.   	EVP_PKEY *clnt_pub_pkey = NULL;
1623.   	EC_POINT *clnt_ecpoint = NULL;
1624. > 	BN_CTX *bn_ctx = NULL; 
1625.   #endif
1626.   

ssl/s3_srvr.c:1627:2: Skipping ssl3_get_message(): empty list of specs
1625.   #endif
1626.   
1627.   	n=ssl3_get_message(s,
         ^
1628.   		SSL3_ST_SR_KEY_EXCH_A,
1629.   		SSL3_ST_SR_KEY_EXCH_B,

ssl/s3_srvr.c:1634:7: Taking false branch
1632.   		&ok);
1633.   
1634.   	if (!ok) return((int)n);
              ^
1635.   	p=(unsigned char *)s->init_msg;
1636.   

ssl/s3_srvr.c:1635:2: 
1633.   
1634.   	if (!ok) return((int)n);
1635. > 	p=(unsigned char *)s->init_msg;
1636.   
1637.   	l=s->s3->tmp.new_cipher->algorithms;

ssl/s3_srvr.c:1637:2: 
1635.   	p=(unsigned char *)s->init_msg;
1636.   
1637. > 	l=s->s3->tmp.new_cipher->algorithms;
1638.   
1639.   #ifndef OPENSSL_NO_RSA

ssl/s3_srvr.c:1640:6: Taking true branch
1638.   
1639.   #ifndef OPENSSL_NO_RSA
1640.   	if (l & SSL_kRSA)
             ^
1641.   		{
1642.   		/* FIX THIS UP EAY EAY EAY EAY */

ssl/s3_srvr.c:1643:7: Taking false branch
1641.   		{
1642.   		/* FIX THIS UP EAY EAY EAY EAY */
1643.   		if (s->s3->tmp.use_rsa_tmp)
              ^
1644.   			{
1645.   			if ((s->cert != NULL) && (s->cert->rsa_tmp != NULL))

ssl/s3_srvr.c:1659:4: 
1657.   		else
1658.   			{
1659. > 			pkey=s->cert->pkeys[SSL_PKEY_RSA_ENC].privatekey;
1660.   			if (	(pkey == NULL) ||
1661.   				(pkey->type != EVP_PKEY_RSA) ||

ssl/s3_srvr.c:1660:10: Taking false branch
1658.   			{
1659.   			pkey=s->cert->pkeys[SSL_PKEY_RSA_ENC].privatekey;
1660.   			if (	(pkey == NULL) ||
                 ^
1661.   				(pkey->type != EVP_PKEY_RSA) ||
1662.   				(pkey->pkey.rsa == NULL))

ssl/s3_srvr.c:1661:6: Taking false branch
1659.   			pkey=s->cert->pkeys[SSL_PKEY_RSA_ENC].privatekey;
1660.   			if (	(pkey == NULL) ||
1661.   				(pkey->type != EVP_PKEY_RSA) ||
             ^
1662.   				(pkey->pkey.rsa == NULL))
1663.   				{

ssl/s3_srvr.c:1662:6: Taking false branch
1660.   			if (	(pkey == NULL) ||
1661.   				(pkey->type != EVP_PKEY_RSA) ||
1662.   				(pkey->pkey.rsa == NULL))
             ^
1663.   				{
1664.   				al=SSL_AD_HANDSHAKE_FAILURE;

ssl/s3_srvr.c:1668:4: 
1666.   				goto f_err;
1667.   				}
1668. > 			rsa=pkey->pkey.rsa;
1669.   			}
1670.   

ssl/s3_srvr.c:1672:7: Taking true branch
1670.   
1671.   		/* TLS */
1672.   		if (s->version > SSL3_VERSION)
              ^
1673.   			{
1674.   			n2s(p,i);

ssl/s3_srvr.c:1674:4: 
1672.   		if (s->version > SSL3_VERSION)
1673.   			{
1674. > 			n2s(p,i);
1675.   			if (n != i+2)
1676.   				{

ssl/s3_srvr.c:1675:8: Taking true branch
1673.   			{
1674.   			n2s(p,i);
1675.   			if (n != i+2)
               ^
1676.   				{
1677.   				if (!(s->options & SSL_OP_TLS_D5_BUG))

ssl/s3_srvr.c:1677:11: Taking true branch
1675.   			if (n != i+2)
1676.   				{
1677.   				if (!(s->options & SSL_OP_TLS_D5_BUG))
                  ^
1678.   					{
1679.   					SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG);

ssl/s3_srvr.c:1679:6: 
1677.   				if (!(s->options & SSL_OP_TLS_D5_BUG))
1678.   					{
1679. > 					SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_TLS_RSA_ENCRYPTED_VALUE_LENGTH_IS_WRONG);
1680.   					goto err;
1681.   					}

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

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

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

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

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

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

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

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

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

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

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

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

ssl/s3_srvr.c:2123:1: 
2121.   	ssl3_send_alert(s,SSL3_AL_FATAL,al);
2122.   #if !defined(OPENSSL_NO_DH) || !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_ECDH)
2123. > err:
2124.   #endif
2125.   #ifndef OPENSSL_NO_ECDH

ssl/s3_srvr.c:2126:2: 
2124.   #endif
2125.   #ifndef OPENSSL_NO_ECDH
2126. > 	EVP_PKEY_free(clnt_pub_pkey);
2127.   	EC_POINT_free(clnt_ecpoint);
2128.   	if (srvr_ecdh != NULL) 
