ssl/s3_enc.c:444: error: MEMORY_LEAK
  memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 437, column 11 is not reachable after line 444, column 9.
Showing all 61 steps of the trace


ssl/s3_enc.c:420:1: start of procedure ssl3_final_finish_mac()
418.   }
419.   
420. > size_t ssl3_final_finish_mac(SSL *s, const char *sender, size_t len,
421.                                unsigned char *p)
422.   {

ssl/s3_enc.c:424:5: 
422.   {
423.       int ret;
424. >     EVP_MD_CTX *ctx = NULL;
425.   
426.       if (!ssl3_digest_cached_records(s, 0)) {

ssl/s3_enc.c:426:10: 
424.       EVP_MD_CTX *ctx = NULL;
425.   
426. >     if (!ssl3_digest_cached_records(s, 0)) {
427.           /* SSLfatal() already called */
428.           return 0;

test/tls13secretstest.c:145:1: start of procedure ssl3_digest_cached_records()
  143.   
  144.   /* Mocked out implementations of various functions */
  145. > int ssl3_digest_cached_records(SSL *s, int keep)
  146.   {
  147.       return 1;

test/tls13secretstest.c:147:5: 
  145.   int ssl3_digest_cached_records(SSL *s, int keep)
  146.   {
  147. >     return 1;
  148.   }
  149.   

test/tls13secretstest.c:148:1: return from a call to ssl3_digest_cached_records
  146.   {
  147.       return 1;
  148. > }
  149.   
  150.   static int full_hash = 0;

ssl/s3_enc.c:426:10: Taking false branch
424.       EVP_MD_CTX *ctx = NULL;
425.   
426.       if (!ssl3_digest_cached_records(s, 0)) {
                ^
427.           /* SSLfatal() already called */
428.           return 0;

ssl/s3_enc.c:431:9: 
429.       }
430.   
431. >     if (EVP_MD_CTX_type(s->s3->handshake_dgst) != NID_md5_sha1) {
432.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,
433.                    SSL_R_NO_REQUIRED_DIGEST);

crypto/evp/evp_lib.c:439:1: start of procedure EVP_MD_CTX_md()
  437.   }
  438.   
  439. > const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx)
  440.   {
  441.       if (!ctx)

crypto/evp/evp_lib.c:441:10: Taking false branch
  439.   const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx)
  440.   {
  441.       if (!ctx)
                  ^
  442.           return NULL;
  443.       return ctx->digest;

crypto/evp/evp_lib.c:443:5: 
  441.       if (!ctx)
  442.           return NULL;
  443. >     return ctx->digest;
  444.   }
  445.   

crypto/evp/evp_lib.c:444:1: return from a call to EVP_MD_CTX_md
  442.           return NULL;
  443.       return ctx->digest;
  444. > }
  445.   
  446.   EVP_PKEY_CTX *EVP_MD_CTX_pkey_ctx(const EVP_MD_CTX *ctx)

crypto/evp/evp_lib.c:291:1: start of procedure EVP_MD_type()
  289.   }
  290.   
  291. > int EVP_MD_type(const EVP_MD *md)
  292.   {
  293.       return md->type;

crypto/evp/evp_lib.c:293:5: 
  291.   int EVP_MD_type(const EVP_MD *md)
  292.   {
  293. >     return md->type;
  294.   }
  295.   

crypto/evp/evp_lib.c:294:1: return from a call to EVP_MD_type
  292.   {
  293.       return md->type;
  294. > }
  295.   
  296.   int EVP_MD_pkey_type(const EVP_MD *md)

ssl/s3_enc.c:431:9: Taking false branch
429.       }
430.   
431.       if (EVP_MD_CTX_type(s->s3->handshake_dgst) != NID_md5_sha1) {
               ^
432.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,
433.                    SSL_R_NO_REQUIRED_DIGEST);

ssl/s3_enc.c:437:5: 
435.       }
436.   
437. >     ctx = EVP_MD_CTX_new();
438.       if (ctx == NULL) {
439.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,

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:228:1: start of procedure CRYPTO_zalloc()
    226.   }
    227.   
    228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    229.   {
    230.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:230:5: 
    228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    229.   {
    230. >     void *ret = CRYPTO_malloc(num, file, line);
    231.   
    232.       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:9: Taking false branch
      202.   
      203.       FAILTEST();
      204.       if (allow_customize) {
                     ^
      205.           /*
      206.            * Disallow customization after the first allocation. We only set this

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)

crypto/mem.c:233:9: Taking true branch
    231.   
    232.       FAILTEST();
    233.       if (ret != NULL)
                   ^
    234.           memset(ret, 0, num);
    235.       return ret;

crypto/mem.c:234:9: 
    232.       FAILTEST();
    233.       if (ret != NULL)
    234. >         memset(ret, 0, num);
    235.       return ret;
    236.   }

crypto/mem.c:235:5: 
    233.       if (ret != NULL)
    234.           memset(ret, 0, num);
    235. >     return ret;
    236.   }
    237.   

crypto/mem.c:236:1: return from a call to CRYPTO_zalloc
    234.           memset(ret, 0, num);
    235.       return ret;
    236. > }
    237.   
    238.   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:438:9: Taking false branch
436.   
437.       ctx = EVP_MD_CTX_new();
438.       if (ctx == NULL) {
               ^
439.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,
440.                    ERR_R_MALLOC_FAILURE);

ssl/s3_enc.c:443:10: 
441.           return 0;
442.       }
443. >     if (!EVP_MD_CTX_copy_ex(ctx, s->s3->handshake_dgst)) {
444.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,
445.                    ERR_R_INTERNAL_ERROR);

crypto/evp/digest.c:204:1: start of procedure EVP_MD_CTX_copy_ex()
  202.   }
  203.   
  204. > int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in)
  205.   {
  206.       unsigned char *tmp_buf;

crypto/evp/digest.c:207:10: Taking false branch
  205.   {
  206.       unsigned char *tmp_buf;
  207.       if ((in == NULL) || (in->digest == NULL)) {
                  ^
  208.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, EVP_R_INPUT_NOT_INITIALIZED);
  209.           return 0;

crypto/evp/digest.c:207:26: Taking false branch
  205.   {
  206.       unsigned char *tmp_buf;
  207.       if ((in == NULL) || (in->digest == NULL)) {
                                  ^
  208.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, EVP_R_INPUT_NOT_INITIALIZED);
  209.           return 0;

crypto/evp/digest.c:213:9: Taking true branch
  211.   #ifndef OPENSSL_NO_ENGINE
  212.       /* Make sure it's safe to copy a digest context using an ENGINE */
  213.       if (in->engine && !ENGINE_init(in->engine)) {
                 ^
  214.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
  215.           return 0;

crypto/evp/digest.c:213:24: 
  211.   #ifndef OPENSSL_NO_ENGINE
  212.       /* Make sure it's safe to copy a digest context using an ENGINE */
  213. >     if (in->engine && !ENGINE_init(in->engine)) {
  214.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
  215.           return 0;

crypto/engine/eng_init.c:77:1: start of procedure ENGINE_init()
    75.   
    76.   /* The API (locked) version of "init" */
    77. > int ENGINE_init(ENGINE *e)
    78.   {
    79.       int ret;

crypto/engine/eng_init.c:80:9: Taking false branch
    78.   {
    79.       int ret;
    80.       if (e == NULL) {
                  ^
    81.           ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_PASSED_NULL_PARAMETER);
    82.           return 0;

crypto/engine/eng_init.c:84:10: 
    82.           return 0;
    83.       }
    84. >     if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {
    85.           ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE);
    86.           return 0;

crypto/threads_pthread.c:105:1: start of procedure CRYPTO_THREAD_run_once()
      103.   }
      104.   
      105. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
      106.   {
      107.       if (pthread_once(once, init) != 0)

crypto/threads_pthread.c:107:9: Taking true branch
      105.   int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
      106.   {
      107.       if (pthread_once(once, init) != 0)
                     ^
      108.           return 0;
      109.   

crypto/threads_pthread.c:108:9: 
      106.   {
      107.       if (pthread_once(once, init) != 0)
      108. >         return 0;
      109.   
      110.       return 1;

crypto/threads_pthread.c:111:1: return from a call to CRYPTO_THREAD_run_once
      109.   
      110.       return 1;
      111. > }
      112.   
      113.   int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))

crypto/engine/eng_init.c:84:10: Condition is false
    82.           return 0;
    83.       }
    84.       if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {
                   ^
    85.           ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE);
    86.           return 0;

crypto/engine/eng_init.c:84:10: Taking true branch
    82.           return 0;
    83.       }
    84.       if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {
                   ^
    85.           ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE);
    86.           return 0;

crypto/engine/eng_init.c:85:9: Skipping ERR_put_error(): empty list of specs
    83.       }
    84.       if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {
    85.           ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE);
                  ^
    86.           return 0;
    87.       }

crypto/engine/eng_init.c:86:9: 
    84.       if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {
    85.           ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_MALLOC_FAILURE);
    86. >         return 0;
    87.       }
    88.       CRYPTO_THREAD_write_lock(global_engine_lock);

crypto/engine/eng_init.c:92:1: return from a call to ENGINE_init
    90.       CRYPTO_THREAD_unlock(global_engine_lock);
    91.       return ret;
    92. > }
    93.   
    94.   /* The API (locked) version of "finish" */

crypto/evp/digest.c:213:24: Taking true branch
  211.   #ifndef OPENSSL_NO_ENGINE
  212.       /* Make sure it's safe to copy a digest context using an ENGINE */
  213.       if (in->engine && !ENGINE_init(in->engine)) {
                                ^
  214.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
  215.           return 0;

crypto/evp/digest.c:214:9: Skipping ERR_put_error(): empty list of specs
  212.       /* Make sure it's safe to copy a digest context using an ENGINE */
  213.       if (in->engine && !ENGINE_init(in->engine)) {
  214.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
                 ^
  215.           return 0;
  216.       }

crypto/evp/digest.c:215:9: 
  213.       if (in->engine && !ENGINE_init(in->engine)) {
  214.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
  215. >         return 0;
  216.       }
  217.   #endif

crypto/evp/digest.c:261:1: return from a call to EVP_MD_CTX_copy_ex
  259.   
  260.       return 1;
  261. > }
  262.   
  263.   int EVP_Digest(const void *data, size_t count,

ssl/s3_enc.c:443:10: Taking true branch
441.           return 0;
442.       }
443.       if (!EVP_MD_CTX_copy_ex(ctx, s->s3->handshake_dgst)) {
                ^
444.           SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,
445.                    ERR_R_INTERNAL_ERROR);

ssl/s3_enc.c:444:9: 
442.       }
443.       if (!EVP_MD_CTX_copy_ex(ctx, s->s3->handshake_dgst)) {
444. >         SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_FINAL_FINISH_MAC,
445.                    ERR_R_INTERNAL_ERROR);
446.           return 0;
