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


ssl/statem/statem_clnt.c:2179:1: start of procedure tls_construct_cke_rsa()
2177.   }
2178.   
2179. > static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt, int *al)
2180.   {
2181.   #ifndef OPENSSL_NO_RSA

ssl/statem/statem_clnt.c:2182:5: 
2180.   {
2181.   #ifndef OPENSSL_NO_RSA
2182. >     unsigned char *encdata = NULL;
2183.       EVP_PKEY *pkey = NULL;
2184.       EVP_PKEY_CTX *pctx = NULL;

ssl/statem/statem_clnt.c:2183:5: 
2181.   #ifndef OPENSSL_NO_RSA
2182.       unsigned char *encdata = NULL;
2183. >     EVP_PKEY *pkey = NULL;
2184.       EVP_PKEY_CTX *pctx = NULL;
2185.       size_t enclen;

ssl/statem/statem_clnt.c:2184:5: 
2182.       unsigned char *encdata = NULL;
2183.       EVP_PKEY *pkey = NULL;
2184. >     EVP_PKEY_CTX *pctx = NULL;
2185.       size_t enclen;
2186.       unsigned char *pms = NULL;

ssl/statem/statem_clnt.c:2186:5: 
2184.       EVP_PKEY_CTX *pctx = NULL;
2185.       size_t enclen;
2186. >     unsigned char *pms = NULL;
2187.       size_t pmslen = 0;
2188.   

ssl/statem/statem_clnt.c:2187:5: 
2185.       size_t enclen;
2186.       unsigned char *pms = NULL;
2187. >     size_t pmslen = 0;
2188.   
2189.       if (s->session->peer == NULL) {

ssl/statem/statem_clnt.c:2189:9: Taking false branch
2187.       size_t pmslen = 0;
2188.   
2189.       if (s->session->peer == NULL) {
                ^
2190.           /*
2191.            * We should always have a server certificate with SSL_kRSA.

ssl/statem/statem_clnt.c:2197:5: 
2195.       }
2196.   
2197. >     pkey = X509_get0_pubkey(s->session->peer);
2198.       if (EVP_PKEY_get0_RSA(pkey) == NULL) {
2199.           SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR);

crypto/x509/x509_cmp.c:265:1: start of procedure X509_get0_pubkey()
  263.   }
  264.   
  265. > EVP_PKEY *X509_get0_pubkey(const X509 *x)
  266.   {
  267.       if (x == NULL)

crypto/x509/x509_cmp.c:267:9: Taking false branch
  265.   EVP_PKEY *X509_get0_pubkey(const X509 *x)
  266.   {
  267.       if (x == NULL)
                 ^
  268.           return NULL;
  269.       return X509_PUBKEY_get0(x->cert_info.key);

crypto/x509/x509_cmp.c:269:5: 
  267.       if (x == NULL)
  268.           return NULL;
  269. >     return X509_PUBKEY_get0(x->cert_info.key);
  270.   }
  271.   

crypto/x509/x_pubkey.c:140:1: start of procedure X509_PUBKEY_get0()
    138.   }
    139.   
    140. > EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key)
    141.   {
    142.       EVP_PKEY *ret = NULL;

crypto/x509/x_pubkey.c:142:5: 
    140.   EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key)
    141.   {
    142. >     EVP_PKEY *ret = NULL;
    143.   
    144.       if (key == NULL || key->public_key == NULL)

crypto/x509/x_pubkey.c:144:9: Taking false branch
    142.       EVP_PKEY *ret = NULL;
    143.   
    144.       if (key == NULL || key->public_key == NULL)
                   ^
    145.           return NULL;
    146.   

crypto/x509/x_pubkey.c:144:24: Taking false branch
    142.       EVP_PKEY *ret = NULL;
    143.   
    144.       if (key == NULL || key->public_key == NULL)
                                  ^
    145.           return NULL;
    146.   

crypto/x509/x_pubkey.c:147:9: Taking true branch
    145.           return NULL;
    146.   
    147.       if (key->pkey != NULL)
                   ^
    148.           return key->pkey;
    149.   

crypto/x509/x_pubkey.c:148:9: 
    146.   
    147.       if (key->pkey != NULL)
    148. >         return key->pkey;
    149.   
    150.       /*

crypto/x509/x_pubkey.c:166:1: return from a call to X509_PUBKEY_get0
    164.   
    165.       return NULL;
    166. > }
    167.   
    168.   EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)

crypto/x509/x509_cmp.c:270:1: return from a call to X509_get0_pubkey
  268.           return NULL;
  269.       return X509_PUBKEY_get0(x->cert_info.key);
  270. > }
  271.   
  272.   EVP_PKEY *X509_get_pubkey(X509 *x)

ssl/statem/statem_clnt.c:2198:9: 
2196.   
2197.       pkey = X509_get0_pubkey(s->session->peer);
2198. >     if (EVP_PKEY_get0_RSA(pkey) == NULL) {
2199.           SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR);
2200.           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:2198:9: Taking false branch
2196.   
2197.       pkey = X509_get0_pubkey(s->session->peer);
2198.       if (EVP_PKEY_get0_RSA(pkey) == NULL) {
                ^
2199.           SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR);
2200.           return 0;

ssl/statem/statem_clnt.c:2203:5: 
2201.       }
2202.   
2203. >     pmslen = SSL_MAX_MASTER_KEY_LENGTH;
2204.       pms = OPENSSL_malloc(pmslen);
2205.       if (pms == NULL) {

ssl/statem/statem_clnt.c:2204:5: 
2202.   
2203.       pmslen = SSL_MAX_MASTER_KEY_LENGTH;
2204. >     pms = OPENSSL_malloc(pmslen);
2205.       if (pms == NULL) {
2206.           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:2205:9: Taking false branch
2203.       pmslen = SSL_MAX_MASTER_KEY_LENGTH;
2204.       pms = OPENSSL_malloc(pmslen);
2205.       if (pms == NULL) {
                ^
2206.           SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_MALLOC_FAILURE);
2207.           *al = SSL_AD_INTERNAL_ERROR;

ssl/statem/statem_clnt.c:2211:5: 
2209.       }
2210.   
2211. >     pms[0] = s->client_version >> 8;
2212.       pms[1] = s->client_version & 0xff;
2213.       /* TODO(size_t): Convert this function */

ssl/statem/statem_clnt.c:2212:5: 
2210.   
2211.       pms[0] = s->client_version >> 8;
2212. >     pms[1] = s->client_version & 0xff;
2213.       /* TODO(size_t): Convert this function */
2214.       if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) {

ssl/statem/statem_clnt.c:2214:9: 
2212.       pms[1] = s->client_version & 0xff;
2213.       /* TODO(size_t): Convert this function */
2214. >     if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) {
2215.           goto err;
2216.       }

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:2214:9: Taking true branch
2212.       pms[1] = s->client_version & 0xff;
2213.       /* TODO(size_t): Convert this function */
2214.       if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) {
                ^
2215.           goto err;
2216.       }

ssl/statem/statem_clnt.c:2253:2: 
2251.   
2252.       return 1;
2253. >  err:
2254.       OPENSSL_clear_free(pms, pmslen);
2255.       EVP_PKEY_CTX_free(pctx);

ssl/statem/statem_clnt.c:2254:5: 
2252.       return 1;
2253.    err:
2254. >     OPENSSL_clear_free(pms, pmslen);
2255.       EVP_PKEY_CTX_free(pctx);
2256.   

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. > }
