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


ssl/ssl_lib.c:3899:1: start of procedure ssl_replace_hash()
3897.    */
3898.   
3899. > EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md)
3900.   {
3901.       ssl_clear_hash_ctx(hash);

ssl/ssl_lib.c:3901:5: 
3899.   EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md)
3900.   {
3901. >     ssl_clear_hash_ctx(hash);
3902.       *hash = EVP_MD_CTX_new();
3903.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {

ssl/ssl_lib.c:3911:1: start of procedure ssl_clear_hash_ctx()
  3909.   }
  3910.   
  3911. > void ssl_clear_hash_ctx(EVP_MD_CTX **hash)
  3912.   {
  3913.   

ssl/ssl_lib.c:3914:5: 
  3912.   {
  3913.   
  3914. >     EVP_MD_CTX_free(*hash);
  3915.       *hash = NULL;
  3916.   }

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:253:1: start of procedure CRYPTO_free()
      251.   }
      252.   
      253. > void CRYPTO_free(void *str, const char *file, int line)
      254.   {
      255.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:255:9: Taking false branch
      253.   void CRYPTO_free(void *str, const char *file, int line)
      254.   {
      255.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                     ^
      256.           free_impl(str, file, line);
      257.           return;

crypto/mem.c:269:5: 
      267.       }
      268.   #else
      269. >     free(str);
      270.   #endif
      271.   }

crypto/mem.c:271:1: return from a call to CRYPTO_free
      269.       free(str);
      270.   #endif
      271. > }
      272.   
      273.   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:3915:5: 
  3913.   
  3914.       EVP_MD_CTX_free(*hash);
  3915. >     *hash = NULL;
  3916.   }
  3917.   

ssl/ssl_lib.c:3916:1: return from a call to ssl_clear_hash_ctx
  3914.       EVP_MD_CTX_free(*hash);
  3915.       *hash = NULL;
  3916. > }
  3917.   
  3918.   /* Retrieve handshake hashes */

ssl/ssl_lib.c:3902:5: 
3900.   {
3901.       ssl_clear_hash_ctx(hash);
3902. >     *hash = EVP_MD_CTX_new();
3903.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
3904.           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: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/ssl_lib.c:3903:9: Taking false branch
3901.       ssl_clear_hash_ctx(hash);
3902.       *hash = EVP_MD_CTX_new();
3903.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
                ^
3904.           EVP_MD_CTX_free(*hash);
3905.           *hash = NULL;

ssl/ssl_lib.c:3903:27: Taking true branch
3901.       ssl_clear_hash_ctx(hash);
3902.       *hash = EVP_MD_CTX_new();
3903.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
                                  ^
3904.           EVP_MD_CTX_free(*hash);
3905.           *hash = NULL;

ssl/ssl_lib.c:3903:33: Taking true branch
3901.       ssl_clear_hash_ctx(hash);
3902.       *hash = EVP_MD_CTX_new();
3903.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
                                        ^
3904.           EVP_MD_CTX_free(*hash);
3905.           *hash = NULL;

ssl/ssl_lib.c:3904:9: 
3902.       *hash = EVP_MD_CTX_new();
3903.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
3904. >         EVP_MD_CTX_free(*hash);
3905.           *hash = NULL;
3906.           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:253:1: start of procedure CRYPTO_free()
    251.   }
    252.   
    253. > void CRYPTO_free(void *str, const char *file, int line)
    254.   {
    255.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:255:9: Taking true branch
    253.   void CRYPTO_free(void *str, const char *file, int line)
    254.   {
    255.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    256.           free_impl(str, file, line);
    257.           return;

crypto/mem.c:255:30: Taking true branch
    253.   void CRYPTO_free(void *str, const char *file, int line)
    254.   {
    255.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    256.           free_impl(str, file, line);
    257.           return;

crypto/mem.c:256:9: Skipping __function_pointer__(): unresolved function pointer
    254.   {
    255.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    256.           free_impl(str, file, line);
                   ^
    257.           return;
    258.       }

crypto/mem.c:257:9: 
    255.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    256.           free_impl(str, file, line);
    257. >         return;
    258.       }
    259.   

crypto/mem.c:271:1: return from a call to CRYPTO_free
    269.       free(str);
    270.   #endif
    271. > }
    272.   
    273.   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:3905:9: 
3903.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
3904.           EVP_MD_CTX_free(*hash);
3905. >         *hash = NULL;
3906.           return NULL;
3907.       }

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}']