ssl/ssl_lib.c:4134: error: MEMORY_LEAK
  memory dynamically allocated to `*hash` by call to `EVP_MD_CTX_new()` at line 4131, column 13 is not reachable after line 4134, column 9.
Showing all 49 steps of the trace


ssl/ssl_lib.c:4128:1: start of procedure ssl_replace_hash()
4126.    */
4127.   
4128. > EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md)
4129.   {
4130.       ssl_clear_hash_ctx(hash);

ssl/ssl_lib.c:4130:5: 
4128.   EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md)
4129.   {
4130. >     ssl_clear_hash_ctx(hash);
4131.       *hash = EVP_MD_CTX_new();
4132.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {

ssl/ssl_lib.c:4140:1: start of procedure ssl_clear_hash_ctx()
  4138.   }
  4139.   
  4140. > void ssl_clear_hash_ctx(EVP_MD_CTX **hash)
  4141.   {
  4142.   

ssl/ssl_lib.c:4143:5: 
  4141.   {
  4142.   
  4143. >     EVP_MD_CTX_free(*hash);
  4144.       *hash = NULL;
  4145.   }

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:264:1: start of procedure CRYPTO_free()
      262.   }
      263.   
      264. > void CRYPTO_free(void *str, const char *file, int line)
      265.   {
      266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:266:9: Taking false branch
      264.   void CRYPTO_free(void *str, const char *file, int line)
      265.   {
      266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                     ^
      267.           free_impl(str, file, line);
      268.           return;

crypto/mem.c:280:5: 
      278.       }
      279.   #else
      280. >     free(str);
      281.   #endif
      282.   }

crypto/mem.c:282:1: return from a call to CRYPTO_free
      280.       free(str);
      281.   #endif
      282. > }
      283.   
      284.   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)

ssl/ssl_lib.c:4144:5: 
  4142.   
  4143.       EVP_MD_CTX_free(*hash);
  4144. >     *hash = NULL;
  4145.   }
  4146.   

ssl/ssl_lib.c:4145:1: return from a call to ssl_clear_hash_ctx
  4143.       EVP_MD_CTX_free(*hash);
  4144.       *hash = NULL;
  4145. > }
  4146.   
  4147.   /* Retrieve handshake hashes */

ssl/ssl_lib.c:4131:5: 
4129.   {
4130.       ssl_clear_hash_ctx(hash);
4131. >     *hash = EVP_MD_CTX_new();
4132.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
4133.           EVP_MD_CTX_free(*hash);

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:197:1: start of procedure CRYPTO_zalloc()
    195.   }
    196.   
    197. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    198.   {
    199.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:199:5: 
    197.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    198.   {
    199. >     void *ret = CRYPTO_malloc(num, file, line);
    200.   
    201.       FAILTEST();

crypto/mem.c:169:1: start of procedure CRYPTO_malloc()
      167.   #endif
      168.   
      169. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      170.   {
      171.       void *ret = NULL;

crypto/mem.c:171:5: 
      169.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      170.   {
      171. >     void *ret = NULL;
      172.   
      173.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:173:9: Taking false branch
      171.       void *ret = NULL;
      172.   
      173.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      174.           return malloc_impl(num, file, line);
      175.   

crypto/mem.c:176:9: Taking false branch
      174.           return malloc_impl(num, file, line);
      175.   
      176.       if (num == 0)
                     ^
      177.           return NULL;
      178.   

crypto/mem.c:180:5: 
      178.   
      179.       FAILTEST();
      180. >     allow_customize = 0;
      181.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      182.       if (call_malloc_debug) {

crypto/mem.c:190:5: 
      188.       }
      189.   #else
      190. >     osslargused(file); osslargused(line);
      191.       ret = malloc(num);
      192.   #endif

crypto/mem.c:190:24: 
      188.       }
      189.   #else
      190. >     osslargused(file); osslargused(line);
      191.       ret = malloc(num);
      192.   #endif

crypto/mem.c:191:5: 
      189.   #else
      190.       osslargused(file); osslargused(line);
      191. >     ret = malloc(num);
      192.   #endif
      193.   

crypto/mem.c:194:5: 
      192.   #endif
      193.   
      194. >     return ret;
      195.   }
      196.   

crypto/mem.c:195:1: return from a call to CRYPTO_malloc
      193.   
      194.       return ret;
      195. > }
      196.   
      197.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:202:9: Taking true branch
    200.   
    201.       FAILTEST();
    202.       if (ret != NULL)
                   ^
    203.           memset(ret, 0, num);
    204.       return ret;

crypto/mem.c:203:9: 
    201.       FAILTEST();
    202.       if (ret != NULL)
    203. >         memset(ret, 0, num);
    204.       return ret;
    205.   }

crypto/mem.c:204:5: 
    202.       if (ret != NULL)
    203.           memset(ret, 0, num);
    204. >     return ret;
    205.   }
    206.   

crypto/mem.c:205:1: return from a call to CRYPTO_zalloc
    203.           memset(ret, 0, num);
    204.       return ret;
    205. > }
    206.   
    207.   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/ssl_lib.c:4132:9: Taking false branch
4130.       ssl_clear_hash_ctx(hash);
4131.       *hash = EVP_MD_CTX_new();
4132.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
                ^
4133.           EVP_MD_CTX_free(*hash);
4134.           *hash = NULL;

ssl/ssl_lib.c:4132:27: Taking true branch
4130.       ssl_clear_hash_ctx(hash);
4131.       *hash = EVP_MD_CTX_new();
4132.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
                                  ^
4133.           EVP_MD_CTX_free(*hash);
4134.           *hash = NULL;

ssl/ssl_lib.c:4132:33: Taking true branch
4130.       ssl_clear_hash_ctx(hash);
4131.       *hash = EVP_MD_CTX_new();
4132.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
                                        ^
4133.           EVP_MD_CTX_free(*hash);
4134.           *hash = NULL;

ssl/ssl_lib.c:4133:9: 
4131.       *hash = EVP_MD_CTX_new();
4132.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
4133. >         EVP_MD_CTX_free(*hash);
4134.           *hash = NULL;
4135.           return NULL;

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:264:1: start of procedure CRYPTO_free()
    262.   }
    263.   
    264. > void CRYPTO_free(void *str, const char *file, int line)
    265.   {
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:266:9: Taking true branch
    264.   void CRYPTO_free(void *str, const char *file, int line)
    265.   {
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    267.           free_impl(str, file, line);
    268.           return;

crypto/mem.c:266:30: Taking true branch
    264.   void CRYPTO_free(void *str, const char *file, int line)
    265.   {
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    267.           free_impl(str, file, line);
    268.           return;

crypto/mem.c:267:9: Skipping __function_pointer__(): unresolved function pointer
    265.   {
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    267.           free_impl(str, file, line);
                   ^
    268.           return;
    269.       }

crypto/mem.c:268:9: 
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    267.           free_impl(str, file, line);
    268. >         return;
    269.       }
    270.   

crypto/mem.c:282:1: return from a call to CRYPTO_free
    280.       free(str);
    281.   #endif
    282. > }
    283.   
    284.   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)

ssl/ssl_lib.c:4134:9: 
4132.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
4133.           EVP_MD_CTX_free(*hash);
4134. >         *hash = NULL;
4135.           return NULL;
4136.       }

EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md)
{
    ssl_clear_hash_ctx(hash);
    *hash = EVP_MD_CTX_new();
    if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
        EVP_MD_CTX_free(*hash);
        *hash = NULL;
        return NULL;
    }
    return *hash;
}
['EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md)\n{\n    ssl_clear_hash_ctx(hash);\n    *hash = EVP_MD_CTX_new();\n    if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {\n        EVP_MD_CTX_free(*hash);\n        *hash = NULL;\n        return NULL;\n    }\n    return *hash;\n}', 'void ssl_clear_hash_ctx(EVP_MD_CTX **hash)\n{\n    EVP_MD_CTX_free(*hash);\n    *hash = NULL;\n}', 'void EVP_MD_CTX_free(EVP_MD_CTX *ctx)\n{\n    EVP_MD_CTX_reset(ctx);\n    OPENSSL_free(ctx);\n}', 'void CRYPTO_free(void *str, const char *file, int line)\n{\n    if (free_impl != NULL && free_impl != &CRYPTO_free) {\n        free_impl(str, file, line);\n        return;\n    }\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_free(str, 0, file, line);\n        free(str);\n        CRYPTO_mem_debug_free(str, 1, file, line);\n    } else {\n        free(str);\n    }\n#else\n    free(str);\n#endif\n}', 'EVP_MD_CTX *EVP_MD_CTX_new(void)\n{\n    return OPENSSL_zalloc(sizeof(EVP_MD_CTX));\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    FAILTEST();\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)\n        return malloc_impl(num, file, line);\n    if (num == 0)\n        return NULL;\n    FAILTEST();\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    osslargused(file); osslargused(line);\n    ret = malloc(num);\n#endif\n    return ret;\n}']