ssl/record/ssl3_record.c:1120: error: MEMORY_LEAK
  memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 1099, column 30 is not reachable after line 1120, column 13.
Showing all 66 steps of the trace


ssl/record/ssl3_record.c:1035:1: start of procedure n_ssl3_mac()
1033.   }
1034.   
1035. > int n_ssl3_mac(SSL *ssl, SSL3_RECORD *rec, unsigned char *md, int send)
1036.   {
1037.       unsigned char *mac_sec, *seq;

ssl/record/ssl3_record.c:1044:9: Taking true branch
1042.       int t;
1043.   
1044.       if (send) {
                ^
1045.           mac_sec = &(ssl->s3->write_mac_secret[0]);
1046.           seq = RECORD_LAYER_get_write_sequence(&ssl->rlayer);

ssl/record/ssl3_record.c:1045:9: 
1043.   
1044.       if (send) {
1045. >         mac_sec = &(ssl->s3->write_mac_secret[0]);
1046.           seq = RECORD_LAYER_get_write_sequence(&ssl->rlayer);
1047.           hash = ssl->write_hash;

ssl/record/ssl3_record.c:1046:9: 
1044.       if (send) {
1045.           mac_sec = &(ssl->s3->write_mac_secret[0]);
1046. >         seq = RECORD_LAYER_get_write_sequence(&ssl->rlayer);
1047.           hash = ssl->write_hash;
1048.       } else {

ssl/record/ssl3_record.c:1047:9: 
1045.           mac_sec = &(ssl->s3->write_mac_secret[0]);
1046.           seq = RECORD_LAYER_get_write_sequence(&ssl->rlayer);
1047. >         hash = ssl->write_hash;
1048.       } else {
1049.           mac_sec = &(ssl->s3->read_mac_secret[0]);

ssl/record/ssl3_record.c:1054:5: 
1052.       }
1053.   
1054. >     t = EVP_MD_CTX_size(hash);
1055.       if (t < 0)
1056.           return 0;

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:301:1: start of procedure EVP_MD_size()
  299.   }
  300.   
  301. > int EVP_MD_size(const EVP_MD *md)
  302.   {
  303.       if (!md) {

crypto/evp/evp_lib.c:303:10: Taking false branch
  301.   int EVP_MD_size(const EVP_MD *md)
  302.   {
  303.       if (!md) {
                  ^
  304.           EVPerr(EVP_F_EVP_MD_SIZE, EVP_R_MESSAGE_DIGEST_IS_NULL);
  305.           return -1;

crypto/evp/evp_lib.c:307:5: 
  305.           return -1;
  306.       }
  307. >     return md->md_size;
  308.   }
  309.   

crypto/evp/evp_lib.c:308:1: return from a call to EVP_MD_size
  306.       }
  307.       return md->md_size;
  308. > }
  309.   
  310.   unsigned long EVP_MD_flags(const EVP_MD *md)

ssl/record/ssl3_record.c:1055:9: Taking false branch
1053.   
1054.       t = EVP_MD_CTX_size(hash);
1055.       if (t < 0)
                ^
1056.           return 0;
1057.       md_size = t;

ssl/record/ssl3_record.c:1057:5: 
1055.       if (t < 0)
1056.           return 0;
1057. >     md_size = t;
1058.       npad = (48 / md_size) * md_size;
1059.   

ssl/record/ssl3_record.c:1058:5: 
1056.           return 0;
1057.       md_size = t;
1058. >     npad = (48 / md_size) * md_size;
1059.   
1060.       if (!send &&

ssl/record/ssl3_record.c:1060:10: Taking false branch
1058.       npad = (48 / md_size) * md_size;
1059.   
1060.       if (!send &&
                 ^
1061.           EVP_CIPHER_CTX_mode(ssl->enc_read_ctx) == EVP_CIPH_CBC_MODE &&
1062.           ssl3_cbc_record_digest_supported(hash)) {

ssl/record/ssl3_record.c:1099:9: 
1097.           unsigned int md_size_u;
1098.           /* Chop the digest off the end :-) */
1099. >         EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
1100.   
1101.           if (md_ctx == NULL)

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:186:1: start of procedure CRYPTO_zalloc()
    184.   }
    185.   
    186. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    187.   {
    188.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:188:5: 
    186.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    187.   {
    188. >     void *ret = CRYPTO_malloc(num, file, line);
    189.   
    190.       FAILTEST();

crypto/mem.c:158:1: start of procedure CRYPTO_malloc()
      156.   #endif
      157.   
      158. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      159.   {
      160.       void *ret = NULL;

crypto/mem.c:160:5: 
      158.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      159.   {
      160. >     void *ret = NULL;
      161.   
      162.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:162:9: Taking false branch
      160.       void *ret = NULL;
      161.   
      162.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      163.           return malloc_impl(num, file, line);
      164.   

crypto/mem.c:165:9: Taking false branch
      163.           return malloc_impl(num, file, line);
      164.   
      165.       if (num == 0)
                     ^
      166.           return NULL;
      167.   

crypto/mem.c:169:5: 
      167.   
      168.       FAILTEST();
      169. >     allow_customize = 0;
      170.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      171.       if (call_malloc_debug) {

crypto/mem.c:179:5: 
      177.       }
      178.   #else
      179. >     osslargused(file); osslargused(line);
      180.       ret = malloc(num);
      181.   #endif

crypto/mem.c:179:24: 
      177.       }
      178.   #else
      179. >     osslargused(file); osslargused(line);
      180.       ret = malloc(num);
      181.   #endif

crypto/mem.c:180:5: 
      178.   #else
      179.       osslargused(file); osslargused(line);
      180. >     ret = malloc(num);
      181.   #endif
      182.   

crypto/mem.c:183:5: 
      181.   #endif
      182.   
      183. >     return ret;
      184.   }
      185.   

crypto/mem.c:184:1: return from a call to CRYPTO_malloc
      182.   
      183.       return ret;
      184. > }
      185.   
      186.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:191:9: Taking true branch
    189.   
    190.       FAILTEST();
    191.       if (ret != NULL)
                   ^
    192.           memset(ret, 0, num);
    193.       return ret;

crypto/mem.c:192:9: 
    190.       FAILTEST();
    191.       if (ret != NULL)
    192. >         memset(ret, 0, num);
    193.       return ret;
    194.   }

crypto/mem.c:193:5: 
    191.       if (ret != NULL)
    192.           memset(ret, 0, num);
    193. >     return ret;
    194.   }
    195.   

crypto/mem.c:194:1: return from a call to CRYPTO_zalloc
    192.           memset(ret, 0, num);
    193.       return ret;
    194. > }
    195.   
    196.   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/record/ssl3_record.c:1101:13: Taking false branch
1099.           EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
1100.   
1101.           if (md_ctx == NULL)
                    ^
1102.               return 0;
1103.   

ssl/record/ssl3_record.c:1104:9: 
1102.               return 0;
1103.   
1104. >         rec_char = rec->type;
1105.           p = md;
1106.           s2n(rec->length, p);

ssl/record/ssl3_record.c:1105:9: 
1103.   
1104.           rec_char = rec->type;
1105. >         p = md;
1106.           s2n(rec->length, p);
1107.           if (EVP_MD_CTX_copy_ex(md_ctx, hash) <= 0

ssl/record/ssl3_record.c:1106:9: 
1104.           rec_char = rec->type;
1105.           p = md;
1106. >         s2n(rec->length, p);
1107.           if (EVP_MD_CTX_copy_ex(md_ctx, hash) <= 0
1108.               || EVP_DigestUpdate(md_ctx, mac_sec, md_size) <= 0

ssl/record/ssl3_record.c:1107:13: 
1105.           p = md;
1106.           s2n(rec->length, p);
1107. >         if (EVP_MD_CTX_copy_ex(md_ctx, hash) <= 0
1108.               || EVP_DigestUpdate(md_ctx, mac_sec, md_size) <= 0
1109.               || EVP_DigestUpdate(md_ctx, ssl3_pad_1, npad) <= 0

crypto/evp/digest.c:183:1: start of procedure EVP_MD_CTX_copy_ex()
  181.   }
  182.   
  183. > int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in)
  184.   {
  185.       unsigned char *tmp_buf;

crypto/evp/digest.c:186:10: Taking false branch
  184.   {
  185.       unsigned char *tmp_buf;
  186.       if ((in == NULL) || (in->digest == NULL)) {
                  ^
  187.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, EVP_R_INPUT_NOT_INITIALIZED);
  188.           return 0;

crypto/evp/digest.c:186:26: Taking false branch
  184.   {
  185.       unsigned char *tmp_buf;
  186.       if ((in == NULL) || (in->digest == NULL)) {
                                  ^
  187.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, EVP_R_INPUT_NOT_INITIALIZED);
  188.           return 0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

crypto/evp/digest.c:194:9: 
  192.       if (in->engine && !ENGINE_init(in->engine)) {
  193.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
  194. >         return 0;
  195.       }
  196.   #endif

crypto/evp/digest.c:240:1: return from a call to EVP_MD_CTX_copy_ex
  238.   
  239.       return 1;
  240. > }
  241.   
  242.   int EVP_Digest(const void *data, size_t count,

ssl/record/ssl3_record.c:1107:13: Taking true branch
1105.           p = md;
1106.           s2n(rec->length, p);
1107.           if (EVP_MD_CTX_copy_ex(md_ctx, hash) <= 0
                    ^
1108.               || EVP_DigestUpdate(md_ctx, mac_sec, md_size) <= 0
1109.               || EVP_DigestUpdate(md_ctx, ssl3_pad_1, npad) <= 0

ssl/record/ssl3_record.c:1120:13: Skipping EVP_MD_CTX_reset(): empty list of specs
1118.               || EVP_DigestUpdate(md_ctx, md, md_size) <= 0
1119.               || EVP_DigestFinal_ex(md_ctx, md, &md_size_u) <= 0) {
1120.               EVP_MD_CTX_reset(md_ctx);
                    ^
1121.               return 0;
1122.           }
