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


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

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

ssl/s3_enc.c:485:5: 
483.       };
484.       unsigned char buf[EVP_MAX_MD_SIZE];
485. >     EVP_MD_CTX *ctx = EVP_MD_CTX_new();
486.       int i, ret = 1;
487.       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: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/s3_enc.c:486:5: 
484.       unsigned char buf[EVP_MAX_MD_SIZE];
485.       EVP_MD_CTX *ctx = EVP_MD_CTX_new();
486. >     int i, ret = 1;
487.       unsigned int n;
488.       size_t ret_secret_size = 0;

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

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

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

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

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

ssl/s3_enc.c:510:13: 
508.               || EVP_DigestUpdate(ctx, buf, n) <= 0
509.               || EVP_DigestFinal_ex(ctx, out, &n) <= 0) {
510. >             SSLfatal(s, SSL_AD_INTERNAL_ERROR,
511.                        SSL_F_SSL3_GENERATE_MASTER_SECRET, ERR_R_INTERNAL_ERROR);
512.               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.   int ossl_statem_export_allowed(SSL *s)

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

ssl/s3_enc.c:518:5: 
516.           ret_secret_size += n;
517.       }
518. >     EVP_MD_CTX_free(ctx);
519.   
520.       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: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)
