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


ssl/s3_enc.c:469:1: start of procedure ssl3_generate_master_secret()
467.   }
468.   
469. > int ssl3_generate_master_secret(SSL *s, unsigned char *out, unsigned char *p,
470.                                   size_t len, size_t *secret_size)
471.   {

ssl/s3_enc.c:472:5: 
470.                                   size_t len, size_t *secret_size)
471.   {
472. >     static const unsigned char *salt[3] = {
473.   #ifndef CHARSET_EBCDIC
474.           (const unsigned char *)"A",

ssl/s3_enc.c:484:5: 
482.       };
483.       unsigned char buf[EVP_MAX_MD_SIZE];
484. >     EVP_MD_CTX *ctx = EVP_MD_CTX_new();
485.       int i, ret = 1;
486.       unsigned int n;

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:218:1: start of procedure CRYPTO_zalloc()
    216.   }
    217.   
    218. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    219.   {
    220.       void *ret = CRYPTO_malloc(num, file, line);

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

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

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

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

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

crypto/mem.c:201:5: 
      199.   
      200.       FAILTEST();
      201. >     allow_customize = 0;
      202.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      203.       if (call_malloc_debug) {

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

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

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

crypto/mem.c:215:5: 
      213.   #endif
      214.   
      215. >     return ret;
      216.   }
      217.   

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

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

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

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

crypto/mem.c:226:1: return from a call to CRYPTO_zalloc
    224.           memset(ret, 0, num);
    225.       return ret;
    226. > }
    227.   
    228.   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/s3_enc.c:485:5: 
483.       unsigned char buf[EVP_MAX_MD_SIZE];
484.       EVP_MD_CTX *ctx = EVP_MD_CTX_new();
485. >     int i, ret = 1;
486.       unsigned int n;
487.       size_t ret_secret_size = 0;

ssl/s3_enc.c:487:5: 
485.       int i, ret = 1;
486.       unsigned int n;
487. >     size_t ret_secret_size = 0;
488.   
489.       if (ctx == NULL) {

ssl/s3_enc.c:489:9: Taking false branch
487.       size_t ret_secret_size = 0;
488.   
489.       if (ctx == NULL) {
               ^
490.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_GENERATE_MASTER_SECRET,
491.                    ERR_R_MALLOC_FAILURE);

ssl/s3_enc.c:494:10: 
492.           return 0;
493.       }
494. >     for (i = 0; i < 3; i++) {
495.           if (EVP_DigestInit_ex(ctx, s->ctx->sha1, NULL) <= 0
496.               || EVP_DigestUpdate(ctx, salt[i],

ssl/s3_enc.c:494:17: Loop condition is true. Entering loop body
492.           return 0;
493.       }
494.       for (i = 0; i < 3; i++) {
                       ^
495.           if (EVP_DigestInit_ex(ctx, s->ctx->sha1, NULL) <= 0
496.               || EVP_DigestUpdate(ctx, salt[i],

ssl/s3_enc.c:495:13: Taking true branch
493.       }
494.       for (i = 0; i < 3; i++) {
495.           if (EVP_DigestInit_ex(ctx, s->ctx->sha1, NULL) <= 0
                   ^
496.               || EVP_DigestUpdate(ctx, salt[i],
497.                                   strlen((const char *)salt[i])) <= 0

ssl/s3_enc.c:509:13: 
507.               || EVP_DigestUpdate(ctx, buf, n) <= 0
508.               || EVP_DigestFinal_ex(ctx, out, &n) <= 0) {
509. >             SSLfatal(s, SSL_AD_INTERNAL_ERROR,
510.                        SSL_F_SSL3_GENERATE_MASTER_SECRET, ERR_R_INTERNAL_ERROR);
511.               ret = 0;

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.   /* End of mocked out code */

ssl/s3_enc.c:511:13: 
509.               SSLfatal(s, SSL_AD_INTERNAL_ERROR,
510.                        SSL_F_SSL3_GENERATE_MASTER_SECRET, ERR_R_INTERNAL_ERROR);
511. >             ret = 0;
512.               break;
513.           }

ssl/s3_enc.c:517:5: 
515.           ret_secret_size += n;
516.       }
517. >     EVP_MD_CTX_free(ctx);
518.   
519.       OPENSSL_cleanse(buf, sizeof(buf));

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:286:1: start of procedure CRYPTO_free()
    284.   }
    285.   
    286. > void CRYPTO_free(void *str, const char *file, int line)
    287.   {
    288.       INCREMENT(free_count);

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

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

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

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

crypto/mem.c:305:1: return from a call to CRYPTO_free
    303.       free(str);
    304.   #endif
    305. > }
    306.   
    307.   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)
