ssl/tls13_enc.c:761: error: MEMORY_LEAK
  memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 715, column 23 is not reachable after line 761, column 5.
Showing all 56 steps of the trace


ssl/tls13_enc.c:706:1: start of procedure tls13_export_keying_material_early()
704.   }
705.   
706. > int tls13_export_keying_material_early(SSL *s, unsigned char *out, size_t olen,
707.                                          const char *label, size_t llen,
708.                                          const unsigned char *context,

ssl/tls13_enc.c:711:5: 
709.                                          size_t contextlen)
710.   {
711. >     static const unsigned char exporterlabel[] = "exporter";
712.       unsigned char exportsecret[EVP_MAX_MD_SIZE];
713.       unsigned char hash[EVP_MAX_MD_SIZE], data[EVP_MAX_MD_SIZE];

ssl/tls13_enc.c:715:5: 
713.       unsigned char hash[EVP_MAX_MD_SIZE], data[EVP_MAX_MD_SIZE];
714.       const EVP_MD *md;
715. >     EVP_MD_CTX *ctx = EVP_MD_CTX_new();
716.       unsigned int hashsize, datalen;
717.       int ret = 0;

crypto/evp/digest.c:44:1: start of procedure EVP_MD_CTX_new()
  42.   }
  43.   
  44. > EVP_MD_CTX *EVP_MD_CTX_new(void)
  45.   {
  46.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));

crypto/evp/digest.c:46:5: 
  44.   EVP_MD_CTX *EVP_MD_CTX_new(void)
  45.   {
  46. >     return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  47.   }
  48.   

crypto/mem.c:221:1: start of procedure CRYPTO_zalloc()
    219.   }
    220.   
    221. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    222.   {
    223.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:223:5: 
    221.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    222.   {
    223. >     void *ret = CRYPTO_malloc(num, file, line);
    224.   
    225.       FAILTEST();

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:5: 
      202.   
      203.       FAILTEST();
      204. >     allow_customize = 0;
      205.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      206.       if (call_malloc_debug) {

crypto/mem.c:214:5: 
      212.       }
      213.   #else
      214. >     (void)(file); (void)(line);
      215.       ret = malloc(num);
      216.   #endif

crypto/mem.c:214:19: 
      212.       }
      213.   #else
      214. >     (void)(file); (void)(line);
      215.       ret = malloc(num);
      216.   #endif

crypto/mem.c:215:5: 
      213.   #else
      214.       (void)(file); (void)(line);
      215. >     ret = malloc(num);
      216.   #endif
      217.   

crypto/mem.c:218:5: 
      216.   #endif
      217.   
      218. >     return ret;
      219.   }
      220.   

crypto/mem.c:219:1: return from a call to CRYPTO_malloc
      217.   
      218.       return ret;
      219. > }
      220.   
      221.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:226:9: Taking true branch
    224.   
    225.       FAILTEST();
    226.       if (ret != NULL)
                   ^
    227.           memset(ret, 0, num);
    228.       return ret;

crypto/mem.c:227:9: 
    225.       FAILTEST();
    226.       if (ret != NULL)
    227. >         memset(ret, 0, num);
    228.       return ret;
    229.   }

crypto/mem.c:228:5: 
    226.       if (ret != NULL)
    227.           memset(ret, 0, num);
    228. >     return ret;
    229.   }
    230.   

crypto/mem.c:229:1: return from a call to CRYPTO_zalloc
    227.           memset(ret, 0, num);
    228.       return ret;
    229. > }
    230.   
    231.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:47:1: return from a call to EVP_MD_CTX_new
  45.   {
  46.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  47. > }
  48.   
  49.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)

ssl/tls13_enc.c:717:5: 
715.       EVP_MD_CTX *ctx = EVP_MD_CTX_new();
716.       unsigned int hashsize, datalen;
717. >     int ret = 0;
718.       const SSL_CIPHER *sslcipher;
719.   

ssl/tls13_enc.c:720:9: Taking false branch
718.       const SSL_CIPHER *sslcipher;
719.   
720.       if (ctx == NULL || !ossl_statem_export_early_allowed(s))
               ^
721.           goto err;
722.   

ssl/tls13_enc.c:720:25: 
718.       const SSL_CIPHER *sslcipher;
719.   
720. >     if (ctx == NULL || !ossl_statem_export_early_allowed(s))
721.           goto err;
722.   

test/tls13secretstest.c:220:1: start of procedure ossl_statem_export_early_allowed()
  218.   }
  219.   
  220. > int ossl_statem_export_early_allowed(SSL *s)
  221.   {
  222.       return 1;

test/tls13secretstest.c:222:5: 
  220.   int ossl_statem_export_early_allowed(SSL *s)
  221.   {
  222. >     return 1;
  223.   }
  224.   

test/tls13secretstest.c:223:1: return from a call to ossl_statem_export_early_allowed
  221.   {
  222.       return 1;
  223. > }
  224.   
  225.   /* End of mocked out code */

ssl/tls13_enc.c:720:25: Taking false branch
718.       const SSL_CIPHER *sslcipher;
719.   
720.       if (ctx == NULL || !ossl_statem_export_early_allowed(s))
                               ^
721.           goto err;
722.   

ssl/tls13_enc.c:723:10: Taking true branch
721.           goto err;
722.   
723.       if (!s->server && s->max_early_data > 0
                ^
724.               && s->session->ext.max_early_data == 0)
725.           sslcipher = SSL_SESSION_get0_cipher(s->psksession);

ssl/tls13_enc.c:723:23: Taking true branch
721.           goto err;
722.   
723.       if (!s->server && s->max_early_data > 0
                             ^
724.               && s->session->ext.max_early_data == 0)
725.           sslcipher = SSL_SESSION_get0_cipher(s->psksession);

ssl/tls13_enc.c:724:16: Taking true branch
722.   
723.       if (!s->server && s->max_early_data > 0
724.               && s->session->ext.max_early_data == 0)
                      ^
725.           sslcipher = SSL_SESSION_get0_cipher(s->psksession);
726.       else

ssl/tls13_enc.c:725:9: 
723.       if (!s->server && s->max_early_data > 0
724.               && s->session->ext.max_early_data == 0)
725. >         sslcipher = SSL_SESSION_get0_cipher(s->psksession);
726.       else
727.           sslcipher = SSL_SESSION_get0_cipher(s->session);

ssl/ssl_sess.c:898:1: start of procedure SSL_SESSION_get0_cipher()
  896.   }
  897.   
  898. > const SSL_CIPHER *SSL_SESSION_get0_cipher(const SSL_SESSION *s)
  899.   {
  900.       return s->cipher;

ssl/ssl_sess.c:900:5: 
  898.   const SSL_CIPHER *SSL_SESSION_get0_cipher(const SSL_SESSION *s)
  899.   {
  900. >     return s->cipher;
  901.   }
  902.   

ssl/ssl_sess.c:901:1: return from a call to SSL_SESSION_get0_cipher
  899.   {
  900.       return s->cipher;
  901. > }
  902.   
  903.   int SSL_SESSION_set_cipher(SSL_SESSION *s, const SSL_CIPHER *cipher)

ssl/tls13_enc.c:729:5: 
727.           sslcipher = SSL_SESSION_get0_cipher(s->session);
728.   
729. >     md = ssl_md(sslcipher->algorithm2);
730.   
731.       /*

test/tls13secretstest.c:205:1: start of procedure ssl_md()
  203.   }
  204.   
  205. > const EVP_MD *ssl_md(int idx)
  206.   {
  207.       return EVP_sha256();

test/tls13secretstest.c:207:5: 
  205.   const EVP_MD *ssl_md(int idx)
  206.   {
  207. >     return EVP_sha256();
  208.   }
  209.   

crypto/evp/m_sha1.c:177:1: start of procedure EVP_sha256()
    175.   };
    176.   
    177. > const EVP_MD *EVP_sha256(void)
    178.   {
    179.       return &sha256_md;

crypto/evp/m_sha1.c:179:5: 
    177.   const EVP_MD *EVP_sha256(void)
    178.   {
    179. >     return &sha256_md;
    180.   }
    181.   

crypto/evp/m_sha1.c:180:1: return from a call to EVP_sha256
    178.   {
    179.       return &sha256_md;
    180. > }
    181.   
    182.   static int init512_224(EVP_MD_CTX *ctx)

test/tls13secretstest.c:208:1: return from a call to ssl_md
  206.   {
  207.       return EVP_sha256();
  208. > }
  209.   
  210.   void ossl_statem_fatal(SSL *s, int al, int func, int reason, const char *file,

ssl/tls13_enc.c:746:9: Taking true branch
744.        * Here Transcript-Hash is the cipher suite hash algorithm.
745.        */
746.       if (EVP_DigestInit_ex(ctx, md, NULL) <= 0
               ^
747.               || EVP_DigestUpdate(ctx, context, contextlen) <= 0
748.               || EVP_DigestFinal_ex(ctx, hash, &hashsize) <= 0

ssl/tls13_enc.c:760:2: 
758.   
759.       ret = 1;
760. >  err:
761.       EVP_MD_CTX_free(ctx);
762.       return ret;

ssl/tls13_enc.c:761:5: 
759.       ret = 1;
760.    err:
761. >     EVP_MD_CTX_free(ctx);
762.       return ret;
763.   }

crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_free()
  47.   }
  48.   
  49. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  50.   {
  51.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:51:5: Skipping EVP_MD_CTX_reset(): empty list of specs
  49.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  50.   {
  51.       EVP_MD_CTX_reset(ctx);
            ^
  52.       OPENSSL_free(ctx);
  53.   }

crypto/evp/digest.c:52:5: 
  50.   {
  51.       EVP_MD_CTX_reset(ctx);
  52. >     OPENSSL_free(ctx);
  53.   }
  54.   

crypto/mem.c:289:1: start of procedure CRYPTO_free()
    287.   }
    288.   
    289. > void CRYPTO_free(void *str, const char *file, int line)
    290.   {
    291.       INCREMENT(free_count);

crypto/mem.c:292:9: Taking true branch
    290.   {
    291.       INCREMENT(free_count);
    292.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    293.           free_impl(str, file, line);
    294.           return;

crypto/mem.c:292:30: Taking true branch
    290.   {
    291.       INCREMENT(free_count);
    292.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    293.           free_impl(str, file, line);
    294.           return;

crypto/mem.c:293:9: Skipping __function_pointer__(): unresolved function pointer
    291.       INCREMENT(free_count);
    292.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    293.           free_impl(str, file, line);
                   ^
    294.           return;
    295.       }

crypto/mem.c:294:9: 
    292.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    293.           free_impl(str, file, line);
    294. >         return;
    295.       }
    296.   

crypto/mem.c:308:1: return from a call to CRYPTO_free
    306.       free(str);
    307.   #endif
    308. > }
    309.   
    310.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:53:1: return from a call to EVP_MD_CTX_free
  51.       EVP_MD_CTX_reset(ctx);
  52.       OPENSSL_free(ctx);
  53. > }
  54.   
  55.   int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
