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


ssl/record/ssl3_record.c:1087:1: start of procedure n_ssl3_mac()
1085.   }
1086.   
1087. > int n_ssl3_mac(SSL *ssl, SSL3_RECORD *rec, unsigned char *md, int sending)
1088.   {
1089.       unsigned char *mac_sec, *seq;

ssl/record/ssl3_record.c:1096:9: Taking true branch
1094.       int t;
1095.   
1096.       if (sending) {
                ^
1097.           mac_sec = &(ssl->s3->write_mac_secret[0]);
1098.           seq = RECORD_LAYER_get_write_sequence(&ssl->rlayer);

ssl/record/ssl3_record.c:1097:9: 
1095.   
1096.       if (sending) {
1097. >         mac_sec = &(ssl->s3->write_mac_secret[0]);
1098.           seq = RECORD_LAYER_get_write_sequence(&ssl->rlayer);
1099.           hash = ssl->write_hash;

ssl/record/ssl3_record.c:1098:9: 
1096.       if (sending) {
1097.           mac_sec = &(ssl->s3->write_mac_secret[0]);
1098. >         seq = RECORD_LAYER_get_write_sequence(&ssl->rlayer);
1099.           hash = ssl->write_hash;
1100.       } else {

ssl/record/ssl3_record.c:1099:9: 
1097.           mac_sec = &(ssl->s3->write_mac_secret[0]);
1098.           seq = RECORD_LAYER_get_write_sequence(&ssl->rlayer);
1099. >         hash = ssl->write_hash;
1100.       } else {
1101.           mac_sec = &(ssl->s3->read_mac_secret[0]);

ssl/record/ssl3_record.c:1106:5: 
1104.       }
1105.   
1106. >     t = EVP_MD_CTX_size(hash);
1107.       if (t < 0)
1108.           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:1107:9: Taking false branch
1105.   
1106.       t = EVP_MD_CTX_size(hash);
1107.       if (t < 0)
                ^
1108.           return 0;
1109.       md_size = t;

ssl/record/ssl3_record.c:1109:5: 
1107.       if (t < 0)
1108.           return 0;
1109. >     md_size = t;
1110.       npad = (48 / md_size) * md_size;
1111.   

ssl/record/ssl3_record.c:1110:5: 
1108.           return 0;
1109.       md_size = t;
1110. >     npad = (48 / md_size) * md_size;
1111.   
1112.       if (!sending &&

ssl/record/ssl3_record.c:1112:10: Taking false branch
1110.       npad = (48 / md_size) * md_size;
1111.   
1112.       if (!sending &&
                 ^
1113.           EVP_CIPHER_CTX_mode(ssl->enc_read_ctx) == EVP_CIPH_CBC_MODE &&
1114.           ssl3_cbc_record_digest_supported(hash)) {

ssl/record/ssl3_record.c:1151:9: 
1149.           unsigned int md_size_u;
1150.           /* Chop the digest off the end :-) */
1151. >         EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
1152.   
1153.           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: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/record/ssl3_record.c:1153:13: Taking false branch
1151.           EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
1152.   
1153.           if (md_ctx == NULL)
                    ^
1154.               return 0;
1155.   

ssl/record/ssl3_record.c:1156:9: 
1154.               return 0;
1155.   
1156. >         rec_char = rec->type;
1157.           p = md;
1158.           s2n(rec->length, p);

ssl/record/ssl3_record.c:1157:9: 
1155.   
1156.           rec_char = rec->type;
1157. >         p = md;
1158.           s2n(rec->length, p);
1159.           if (EVP_MD_CTX_copy_ex(md_ctx, hash) <= 0

ssl/record/ssl3_record.c:1158:9: 
1156.           rec_char = rec->type;
1157.           p = md;
1158. >         s2n(rec->length, p);
1159.           if (EVP_MD_CTX_copy_ex(md_ctx, hash) <= 0
1160.               || EVP_DigestUpdate(md_ctx, mac_sec, md_size) <= 0

ssl/record/ssl3_record.c:1159:13: 
1157.           p = md;
1158.           s2n(rec->length, p);
1159. >         if (EVP_MD_CTX_copy_ex(md_ctx, hash) <= 0
1160.               || EVP_DigestUpdate(md_ctx, mac_sec, md_size) <= 0
1161.               || EVP_DigestUpdate(md_ctx, ssl3_pad_1, npad) <= 0

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/record/ssl3_record.c:1159:13: Taking true branch
1157.           p = md;
1158.           s2n(rec->length, p);
1159.           if (EVP_MD_CTX_copy_ex(md_ctx, hash) <= 0
                    ^
1160.               || EVP_DigestUpdate(md_ctx, mac_sec, md_size) <= 0
1161.               || EVP_DigestUpdate(md_ctx, ssl3_pad_1, npad) <= 0

ssl/record/ssl3_record.c:1172:13: Skipping EVP_MD_CTX_reset(): empty list of specs
1170.               || EVP_DigestUpdate(md_ctx, md, md_size) <= 0
1171.               || EVP_DigestFinal_ex(md_ctx, md, &md_size_u) <= 0) {
1172.               EVP_MD_CTX_reset(md_ctx);
                    ^
1173.               return 0;
1174.           }
