ssl/statem/statem_clnt.c:2212: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_malloc()` at line 2164, column 11 is not reachable after line 2212, column 5.
Showing all 58 steps of the trace


ssl/statem/statem_clnt.c:2139:1: start of procedure tls_construct_cke_rsa()
2137.   }
2138.   
2139. > static int tls_construct_cke_rsa(SSL *s, unsigned char **p, int *len, int *al)
2140.   {
2141.   #ifndef OPENSSL_NO_RSA

ssl/statem/statem_clnt.c:2143:5: 
2141.   #ifndef OPENSSL_NO_RSA
2142.       unsigned char *q;
2143. >     EVP_PKEY *pkey = NULL;
2144.       EVP_PKEY_CTX *pctx = NULL;
2145.       size_t enclen;

ssl/statem/statem_clnt.c:2144:5: 
2142.       unsigned char *q;
2143.       EVP_PKEY *pkey = NULL;
2144. >     EVP_PKEY_CTX *pctx = NULL;
2145.       size_t enclen;
2146.       unsigned char *pms = NULL;

ssl/statem/statem_clnt.c:2146:5: 
2144.       EVP_PKEY_CTX *pctx = NULL;
2145.       size_t enclen;
2146. >     unsigned char *pms = NULL;
2147.       size_t pmslen = 0;
2148.   

ssl/statem/statem_clnt.c:2147:5: 
2145.       size_t enclen;
2146.       unsigned char *pms = NULL;
2147. >     size_t pmslen = 0;
2148.   
2149.       if (s->session->peer == NULL) {

ssl/statem/statem_clnt.c:2149:9: Taking false branch
2147.       size_t pmslen = 0;
2148.   
2149.       if (s->session->peer == NULL) {
                ^
2150.           /*
2151.            * We should always have a server certificate with SSL_kRSA.

ssl/statem/statem_clnt.c:2157:5: 
2155.       }
2156.   
2157. >     pkey = X509_get0_pubkey(s->session->peer);
2158.       if (EVP_PKEY_get0_RSA(pkey) == NULL) {
2159.           SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR);

crypto/x509/x509_cmp.c:260:1: start of procedure X509_get0_pubkey()
  258.   }
  259.   
  260. > EVP_PKEY *X509_get0_pubkey(X509 *x)
  261.   {
  262.       if (x == NULL)

crypto/x509/x509_cmp.c:262:9: Taking false branch
  260.   EVP_PKEY *X509_get0_pubkey(X509 *x)
  261.   {
  262.       if (x == NULL)
                 ^
  263.           return NULL;
  264.       return X509_PUBKEY_get0(x->cert_info.key);

crypto/x509/x509_cmp.c:264:5: Skipping X509_PUBKEY_get0(): empty list of specs
  262.       if (x == NULL)
  263.           return NULL;
  264.       return X509_PUBKEY_get0(x->cert_info.key);
             ^
  265.   }
  266.   

crypto/x509/x509_cmp.c:265:1: return from a call to X509_get0_pubkey
  263.           return NULL;
  264.       return X509_PUBKEY_get0(x->cert_info.key);
  265. > }
  266.   
  267.   EVP_PKEY *X509_get_pubkey(X509 *x)

ssl/statem/statem_clnt.c:2158:9: 
2156.   
2157.       pkey = X509_get0_pubkey(s->session->peer);
2158. >     if (EVP_PKEY_get0_RSA(pkey) == NULL) {
2159.           SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR);
2160.           return 0;

crypto/evp/p_lib.c:261:1: start of procedure EVP_PKEY_get0_RSA()
  259.   }
  260.   
  261. > RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
  262.   {
  263.       if (pkey->type != EVP_PKEY_RSA) {

crypto/evp/p_lib.c:263:9: Taking false branch
  261.   RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
  262.   {
  263.       if (pkey->type != EVP_PKEY_RSA) {
                 ^
  264.           EVPerr(EVP_F_EVP_PKEY_GET0_RSA, EVP_R_EXPECTING_AN_RSA_KEY);
  265.           return NULL;

crypto/evp/p_lib.c:267:5: 
  265.           return NULL;
  266.       }
  267. >     return pkey->pkey.rsa;
  268.   }
  269.   

crypto/evp/p_lib.c:268:1: return from a call to EVP_PKEY_get0_RSA
  266.       }
  267.       return pkey->pkey.rsa;
  268. > }
  269.   
  270.   RSA *EVP_PKEY_get1_RSA(EVP_PKEY *pkey)

ssl/statem/statem_clnt.c:2158:9: Taking false branch
2156.   
2157.       pkey = X509_get0_pubkey(s->session->peer);
2158.       if (EVP_PKEY_get0_RSA(pkey) == NULL) {
                ^
2159.           SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR);
2160.           return 0;

ssl/statem/statem_clnt.c:2163:5: 
2161.       }
2162.   
2163. >     pmslen = SSL_MAX_MASTER_KEY_LENGTH;
2164.       pms = OPENSSL_malloc(pmslen);
2165.       if (pms == NULL) {

ssl/statem/statem_clnt.c:2164:5: 
2162.   
2163.       pmslen = SSL_MAX_MASTER_KEY_LENGTH;
2164. >     pms = OPENSSL_malloc(pmslen);
2165.       if (pms == NULL) {
2166.           SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_MALLOC_FAILURE);

crypto/mem.c:71:1: start of procedure CRYPTO_malloc()
  69.   }
  70.   
  71. > void *CRYPTO_malloc(size_t num, const char *file, int line)
  72.   {
  73.       void *ret = NULL;

crypto/mem.c:73:5: 
  71.   void *CRYPTO_malloc(size_t num, const char *file, int line)
  72.   {
  73. >     void *ret = NULL;
  74.   
  75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:75:9: Taking false branch
  73.       void *ret = NULL;
  74.   
  75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                ^
  76.           return malloc_impl(num, file, line);
  77.   

crypto/mem.c:78:9: Taking false branch
  76.           return malloc_impl(num, file, line);
  77.   
  78.       if (num <= 0)
                ^
  79.           return NULL;
  80.   

crypto/mem.c:81:5: 
  79.           return NULL;
  80.   
  81. >     allow_customize = 0;
  82.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
  83.       if (call_malloc_debug) {

crypto/mem.c:91:5: 
  89.       }
  90.   #else
  91. >     osslargused(file); osslargused(line);
  92.       ret = malloc(num);
  93.   #endif

crypto/mem.c:91:24: 
  89.       }
  90.   #else
  91. >     osslargused(file); osslargused(line);
  92.       ret = malloc(num);
  93.   #endif

crypto/mem.c:92:5: 
  90.   #else
  91.       osslargused(file); osslargused(line);
  92. >     ret = malloc(num);
  93.   #endif
  94.   

crypto/mem.c:95:5: 
  93.   #endif
  94.   
  95. >     return ret;
  96.   }
  97.   

crypto/mem.c:96:1: return from a call to CRYPTO_malloc
  94.   
  95.       return ret;
  96. > }
  97.   
  98.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

ssl/statem/statem_clnt.c:2165:9: Taking false branch
2163.       pmslen = SSL_MAX_MASTER_KEY_LENGTH;
2164.       pms = OPENSSL_malloc(pmslen);
2165.       if (pms == NULL) {
                ^
2166.           SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_MALLOC_FAILURE);
2167.           *al = SSL_AD_INTERNAL_ERROR;

ssl/statem/statem_clnt.c:2171:5: 
2169.       }
2170.   
2171. >     pms[0] = s->client_version >> 8;
2172.       pms[1] = s->client_version & 0xff;
2173.       if (RAND_bytes(pms + 2, pmslen - 2) <= 0) {

ssl/statem/statem_clnt.c:2172:5: 
2170.   
2171.       pms[0] = s->client_version >> 8;
2172. >     pms[1] = s->client_version & 0xff;
2173.       if (RAND_bytes(pms + 2, pmslen - 2) <= 0) {
2174.           goto err;

ssl/statem/statem_clnt.c:2173:9: 
2171.       pms[0] = s->client_version >> 8;
2172.       pms[1] = s->client_version & 0xff;
2173. >     if (RAND_bytes(pms + 2, pmslen - 2) <= 0) {
2174.           goto err;
2175.       }

crypto/rand/rand_lib.c:102:1: start of procedure RAND_bytes()
  100.   }
  101.   
  102. > int RAND_bytes(unsigned char *buf, int num)
  103.   {
  104.       const RAND_METHOD *meth = RAND_get_rand_method();

crypto/rand/rand_lib.c:104:5: 
  102.   int RAND_bytes(unsigned char *buf, int num)
  103.   {
  104. >     const RAND_METHOD *meth = RAND_get_rand_method();
  105.       if (meth && meth->bytes)
  106.           return meth->bytes(buf, num);

crypto/rand/rand_lib.c:39:1: start of procedure RAND_get_rand_method()
    37.   }
    38.   
    39. > const RAND_METHOD *RAND_get_rand_method(void)
    40.   {
    41.       if (!default_RAND_meth) {

crypto/rand/rand_lib.c:41:10: Taking false branch
    39.   const RAND_METHOD *RAND_get_rand_method(void)
    40.   {
    41.       if (!default_RAND_meth) {
                   ^
    42.   #ifndef OPENSSL_NO_ENGINE
    43.           ENGINE *e = ENGINE_get_default_RAND();

crypto/rand/rand_lib.c:57:5: 
    55.               default_RAND_meth = RAND_OpenSSL();
    56.       }
    57. >     return default_RAND_meth;
    58.   }
    59.   

crypto/rand/rand_lib.c:58:1: return from a call to RAND_get_rand_method
    56.       }
    57.       return default_RAND_meth;
    58. > }
    59.   
    60.   #ifndef OPENSSL_NO_ENGINE

crypto/rand/rand_lib.c:105:9: Taking true branch
  103.   {
  104.       const RAND_METHOD *meth = RAND_get_rand_method();
  105.       if (meth && meth->bytes)
                 ^
  106.           return meth->bytes(buf, num);
  107.       return (-1);

crypto/rand/rand_lib.c:105:17: Taking false branch
  103.   {
  104.       const RAND_METHOD *meth = RAND_get_rand_method();
  105.       if (meth && meth->bytes)
                         ^
  106.           return meth->bytes(buf, num);
  107.       return (-1);

crypto/rand/rand_lib.c:107:5: 
  105.       if (meth && meth->bytes)
  106.           return meth->bytes(buf, num);
  107. >     return (-1);
  108.   }
  109.   

crypto/rand/rand_lib.c:108:1: return from a call to RAND_bytes
  106.           return meth->bytes(buf, num);
  107.       return (-1);
  108. > }
  109.   
  110.   #if OPENSSL_API_COMPAT < 0x10100000L

ssl/statem/statem_clnt.c:2173:9: Taking true branch
2171.       pms[0] = s->client_version >> 8;
2172.       pms[1] = s->client_version & 0xff;
2173.       if (RAND_bytes(pms + 2, pmslen - 2) <= 0) {
                ^
2174.           goto err;
2175.       }

ssl/statem/statem_clnt.c:2211:2: 
2209.   
2210.       return 1;
2211. >  err:
2212.       OPENSSL_clear_free(pms, pmslen);
2213.       EVP_PKEY_CTX_free(pctx);

ssl/statem/statem_clnt.c:2212:5: 
2210.       return 1;
2211.    err:
2212. >     OPENSSL_clear_free(pms, pmslen);
2213.       EVP_PKEY_CTX_free(pctx);
2214.   

crypto/mem.c:183:1: start of procedure CRYPTO_clear_free()
  181.   }
  182.   
  183. > void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
  184.   {
  185.       if (str == NULL)

crypto/mem.c:185:9: Taking false branch
  183.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
  184.   {
  185.       if (str == NULL)
                 ^
  186.           return;
  187.       if (num)

crypto/mem.c:187:9: Taking true branch
  185.       if (str == NULL)
  186.           return;
  187.       if (num)
                 ^
  188.           OPENSSL_cleanse(str, num);
  189.       CRYPTO_free(str, file, line);

crypto/mem.c:188:9: Skipping OPENSSL_cleanse(): method has no implementation
  186.           return;
  187.       if (num)
  188.           OPENSSL_cleanse(str, num);
                 ^
  189.       CRYPTO_free(str, file, line);
  190.   }

crypto/mem.c:189:5: 
  187.       if (num)
  188.           OPENSSL_cleanse(str, num);
  189. >     CRYPTO_free(str, file, line);
  190.   }

crypto/mem.c:163:1: start of procedure CRYPTO_free()
    161.   }
    162.   
    163. > void CRYPTO_free(void *str, const char *file, int line)
    164.   {
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:165:9: Taking true branch
    163.   void CRYPTO_free(void *str, const char *file, int line)
    164.   {
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    166.           free_impl(str, file, line);
    167.           return;

crypto/mem.c:165:30: Taking true branch
    163.   void CRYPTO_free(void *str, const char *file, int line)
    164.   {
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    166.           free_impl(str, file, line);
    167.           return;

crypto/mem.c:166:9: Skipping __function_pointer__(): unresolved function pointer
    164.   {
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    166.           free_impl(str, file, line);
                   ^
    167.           return;
    168.       }

crypto/mem.c:167:9: 
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    166.           free_impl(str, file, line);
    167. >         return;
    168.       }
    169.   

crypto/mem.c:181:1: return from a call to CRYPTO_free
    179.       free(str);
    180.   #endif
    181. > }
    182.   
    183.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/mem.c:190:1: return from a call to CRYPTO_clear_free
  188.           OPENSSL_cleanse(str, num);
  189.       CRYPTO_free(str, file, line);
  190. > }
