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


ssl/statem/statem_clnt.c:2898:1: start of procedure tls_construct_cke_rsa()
2896.   }
2897.   
2898. > static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt)
2899.   {
2900.   #ifndef OPENSSL_NO_RSA

ssl/statem/statem_clnt.c:2901:5: 
2899.   {
2900.   #ifndef OPENSSL_NO_RSA
2901. >     unsigned char *encdata = NULL;
2902.       EVP_PKEY *pkey = NULL;
2903.       EVP_PKEY_CTX *pctx = NULL;

ssl/statem/statem_clnt.c:2902:5: 
2900.   #ifndef OPENSSL_NO_RSA
2901.       unsigned char *encdata = NULL;
2902. >     EVP_PKEY *pkey = NULL;
2903.       EVP_PKEY_CTX *pctx = NULL;
2904.       size_t enclen;

ssl/statem/statem_clnt.c:2903:5: 
2901.       unsigned char *encdata = NULL;
2902.       EVP_PKEY *pkey = NULL;
2903. >     EVP_PKEY_CTX *pctx = NULL;
2904.       size_t enclen;
2905.       unsigned char *pms = NULL;

ssl/statem/statem_clnt.c:2905:5: 
2903.       EVP_PKEY_CTX *pctx = NULL;
2904.       size_t enclen;
2905. >     unsigned char *pms = NULL;
2906.       size_t pmslen = 0;
2907.   

ssl/statem/statem_clnt.c:2906:5: 
2904.       size_t enclen;
2905.       unsigned char *pms = NULL;
2906. >     size_t pmslen = 0;
2907.   
2908.       if (s->session->peer == NULL) {

ssl/statem/statem_clnt.c:2908:9: Taking false branch
2906.       size_t pmslen = 0;
2907.   
2908.       if (s->session->peer == NULL) {
                ^
2909.           /*
2910.            * We should always have a server certificate with SSL_kRSA.

ssl/statem/statem_clnt.c:2917:5: 
2915.       }
2916.   
2917. >     pkey = X509_get0_pubkey(s->session->peer);
2918.       if (EVP_PKEY_get0_RSA(pkey) == NULL) {
2919.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,

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

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

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

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:269:1: return from a call to X509_get0_pubkey
  267.           return NULL;
  268.       return X509_PUBKEY_get0(x->cert_info.key);
  269. > }
  270.   
  271.   EVP_PKEY *X509_get_pubkey(X509 *x)

ssl/statem/statem_clnt.c:2918:9: 
2916.   
2917.       pkey = X509_get0_pubkey(s->session->peer);
2918. >     if (EVP_PKEY_get0_RSA(pkey) == NULL) {
2919.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,
2920.                    ERR_R_INTERNAL_ERROR);

crypto/evp/p_lib.c:407:1: start of procedure EVP_PKEY_get0_RSA()
  405.   }
  406.   
  407. > RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
  408.   {
  409.       if (pkey->type != EVP_PKEY_RSA) {

crypto/evp/p_lib.c:409:9: Taking false branch
  407.   RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
  408.   {
  409.       if (pkey->type != EVP_PKEY_RSA) {
                 ^
  410.           EVPerr(EVP_F_EVP_PKEY_GET0_RSA, EVP_R_EXPECTING_AN_RSA_KEY);
  411.           return NULL;

crypto/evp/p_lib.c:413:5: 
  411.           return NULL;
  412.       }
  413. >     return pkey->pkey.rsa;
  414.   }
  415.   

crypto/evp/p_lib.c:414:1: return from a call to EVP_PKEY_get0_RSA
  412.       }
  413.       return pkey->pkey.rsa;
  414. > }
  415.   
  416.   RSA *EVP_PKEY_get1_RSA(EVP_PKEY *pkey)

ssl/statem/statem_clnt.c:2918:9: Taking false branch
2916.   
2917.       pkey = X509_get0_pubkey(s->session->peer);
2918.       if (EVP_PKEY_get0_RSA(pkey) == NULL) {
                ^
2919.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,
2920.                    ERR_R_INTERNAL_ERROR);

ssl/statem/statem_clnt.c:2924:5: 
2922.       }
2923.   
2924. >     pmslen = SSL_MAX_MASTER_KEY_LENGTH;
2925.       pms = OPENSSL_malloc(pmslen);
2926.       if (pms == NULL) {

ssl/statem/statem_clnt.c:2925:5: 
2923.   
2924.       pmslen = SSL_MAX_MASTER_KEY_LENGTH;
2925. >     pms = OPENSSL_malloc(pmslen);
2926.       if (pms == NULL) {
2927.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,

crypto/mem.c:192:1: start of procedure CRYPTO_malloc()
  190.   #endif
  191.   
  192. > void *CRYPTO_malloc(size_t num, const char *file, int line)
  193.   {
  194.       void *ret = NULL;

crypto/mem.c:194:5: 
  192.   void *CRYPTO_malloc(size_t num, const char *file, int line)
  193.   {
  194. >     void *ret = NULL;
  195.   
  196.       INCREMENT(malloc_count);

crypto/mem.c:197:9: Taking false branch
  195.   
  196.       INCREMENT(malloc_count);
  197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                 ^
  198.           return malloc_impl(num, file, line);
  199.   

crypto/mem.c:200:9: Taking false branch
  198.           return malloc_impl(num, file, line);
  199.   
  200.       if (num == 0)
                 ^
  201.           return NULL;
  202.   

crypto/mem.c:204:9: Taking true branch
  202.   
  203.       FAILTEST();
  204.       if (allow_customize) {
                 ^
  205.           /*
  206.            * Disallow customization after the first allocation. We only set this

crypto/mem.c:210:9: 
  208.            * allocation.
  209.            */
  210. >         allow_customize = 0;
  211.       }
  212.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG

crypto/mem.c:221:5: 
  219.       }
  220.   #else
  221. >     (void)(file); (void)(line);
  222.       ret = malloc(num);
  223.   #endif

crypto/mem.c:221:19: 
  219.       }
  220.   #else
  221. >     (void)(file); (void)(line);
  222.       ret = malloc(num);
  223.   #endif

crypto/mem.c:222:5: 
  220.   #else
  221.       (void)(file); (void)(line);
  222. >     ret = malloc(num);
  223.   #endif
  224.   

crypto/mem.c:225:5: 
  223.   #endif
  224.   
  225. >     return ret;
  226.   }
  227.   

crypto/mem.c:226:1: return from a call to CRYPTO_malloc
  224.   
  225.       return ret;
  226. > }
  227.   
  228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

ssl/statem/statem_clnt.c:2926:9: Taking false branch
2924.       pmslen = SSL_MAX_MASTER_KEY_LENGTH;
2925.       pms = OPENSSL_malloc(pmslen);
2926.       if (pms == NULL) {
                ^
2927.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,
2928.                    ERR_R_MALLOC_FAILURE);

ssl/statem/statem_clnt.c:2932:5: 
2930.       }
2931.   
2932. >     pms[0] = s->client_version >> 8;
2933.       pms[1] = s->client_version & 0xff;
2934.       /* TODO(size_t): Convert this function */

ssl/statem/statem_clnt.c:2933:5: 
2931.   
2932.       pms[0] = s->client_version >> 8;
2933. >     pms[1] = s->client_version & 0xff;
2934.       /* TODO(size_t): Convert this function */
2935.       if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) {

ssl/statem/statem_clnt.c:2935:9: Taking false branch
2933.       pms[1] = s->client_version & 0xff;
2934.       /* TODO(size_t): Convert this function */
2935.       if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) {
                ^
2936.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,
2937.                    ERR_R_MALLOC_FAILURE);

ssl/statem/statem_clnt.c:2942:9: Taking true branch
2940.   
2941.       /* Fix buf for TLS and beyond */
2942.       if (s->version > SSL3_VERSION && !WPACKET_start_sub_packet_u16(pkt)) {
                ^
2943.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,
2944.                    ERR_R_INTERNAL_ERROR);

ssl/statem/statem_clnt.c:2942:39: Taking true branch
2940.   
2941.       /* Fix buf for TLS and beyond */
2942.       if (s->version > SSL3_VERSION && !WPACKET_start_sub_packet_u16(pkt)) {
                                              ^
2943.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,
2944.                    ERR_R_INTERNAL_ERROR);

ssl/statem/statem_clnt.c:2943:9: 
2941.       /* Fix buf for TLS and beyond */
2942.       if (s->version > SSL3_VERSION && !WPACKET_start_sub_packet_u16(pkt)) {
2943. >         SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,
2944.                    ERR_R_INTERNAL_ERROR);
2945.           goto err;

test/tls13secretstest.c:210:1: start of procedure ossl_statem_fatal()
  208.   }
  209.   
  210. > void ossl_statem_fatal(SSL *s, int al, int func, int reason, const char *file,
  211.                              int line)
  212.   {

test/tls13secretstest.c:213:1: return from a call to ossl_statem_fatal
  211.                              int line)
  212.   {
  213. > }
  214.   
  215.   int ossl_statem_export_allowed(SSL *s)

ssl/statem/statem_clnt.c:2980:2: 
2978.   
2979.       return 1;
2980. >  err:
2981.       OPENSSL_clear_free(pms, pmslen);
2982.       EVP_PKEY_CTX_free(pctx);

ssl/statem/statem_clnt.c:2981:5: 
2979.       return 1;
2980.    err:
2981. >     OPENSSL_clear_free(pms, pmslen);
2982.       EVP_PKEY_CTX_free(pctx);
2983.   

crypto/mem.c:316:1: start of procedure CRYPTO_clear_free()
  314.   }
  315.   
  316. > void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
  317.   {
  318.       if (str == NULL)

crypto/mem.c:318:9: Taking false branch
  316.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
  317.   {
  318.       if (str == NULL)
                 ^
  319.           return;
  320.       if (num)

crypto/mem.c:320:9: Taking true branch
  318.       if (str == NULL)
  319.           return;
  320.       if (num)
                 ^
  321.           OPENSSL_cleanse(str, num);
  322.       CRYPTO_free(str, file, line);

crypto/mem.c:321:9: Skipping OPENSSL_cleanse(): method has no implementation
  319.           return;
  320.       if (num)
  321.           OPENSSL_cleanse(str, num);
                 ^
  322.       CRYPTO_free(str, file, line);
  323.   }

crypto/mem.c:322:5: 
  320.       if (num)
  321.           OPENSSL_cleanse(str, num);
  322. >     CRYPTO_free(str, file, line);
  323.   }

crypto/mem.c:295:1: start of procedure CRYPTO_free()
    293.   }
    294.   
    295. > void CRYPTO_free(void *str, const char *file, int line)
    296.   {
    297.       INCREMENT(free_count);

crypto/mem.c:298:9: Taking true branch
    296.   {
    297.       INCREMENT(free_count);
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    299.           free_impl(str, file, line);
    300.           return;

crypto/mem.c:298:30: Taking true branch
    296.   {
    297.       INCREMENT(free_count);
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    299.           free_impl(str, file, line);
    300.           return;

crypto/mem.c:299:9: Skipping __function_pointer__(): unresolved function pointer
    297.       INCREMENT(free_count);
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    299.           free_impl(str, file, line);
                   ^
    300.           return;
    301.       }

crypto/mem.c:300:9: 
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    299.           free_impl(str, file, line);
    300. >         return;
    301.       }
    302.   

crypto/mem.c:314:1: return from a call to CRYPTO_free
    312.       free(str);
    313.   #endif
    314. > }
    315.   
    316.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

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