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


ssl/ssl_lib.c:3586:1: start of procedure ssl_replace_hash()
3584.    */
3585.   
3586. > EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md)
3587.   {
3588.       ssl_clear_hash_ctx(hash);

ssl/ssl_lib.c:3588:5: 
3586.   EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md)
3587.   {
3588. >     ssl_clear_hash_ctx(hash);
3589.       *hash = EVP_MD_CTX_new();
3590.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {

ssl/ssl_lib.c:3598:1: start of procedure ssl_clear_hash_ctx()
  3596.   }
  3597.   
  3598. > void ssl_clear_hash_ctx(EVP_MD_CTX **hash)
  3599.   {
  3600.   

ssl/ssl_lib.c:3601:9: Taking true branch
  3599.   {
  3600.   
  3601.       if (*hash)
                  ^
  3602.           EVP_MD_CTX_free(*hash);
  3603.       *hash = NULL;

ssl/ssl_lib.c:3602:9: 
  3600.   
  3601.       if (*hash)
  3602. >         EVP_MD_CTX_free(*hash);
  3603.       *hash = NULL;
  3604.   }

crypto/evp/digest.c:157:1: start of procedure EVP_MD_CTX_free()
    155.   }
    156.   
    157. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
    158.   {
    159.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:159:5: Skipping EVP_MD_CTX_reset(): empty list of specs
    157.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
    158.   {
    159.       EVP_MD_CTX_reset(ctx);
               ^
    160.       OPENSSL_free(ctx);
    161.   }

crypto/evp/digest.c:160:5: 
    158.   {
    159.       EVP_MD_CTX_reset(ctx);
    160. >     OPENSSL_free(ctx);
    161.   }
    162.   

crypto/mem.c:225:1: start of procedure CRYPTO_free()
      223.   }
      224.   
      225. > void CRYPTO_free(void *str, const char *file, int line)
      226.   {
      227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:227:9: Taking false branch
      225.   void CRYPTO_free(void *str, const char *file, int line)
      226.   {
      227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                     ^
      228.           free_impl(str, file, line);
      229.           return;

crypto/mem.c:241:5: 
      239.       }
      240.   #else
      241. >     free(str);
      242.   #endif
      243.   }

crypto/mem.c:243:1: return from a call to CRYPTO_free
      241.       free(str);
      242.   #endif
      243. > }
      244.   
      245.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:161:1: return from a call to EVP_MD_CTX_free
    159.       EVP_MD_CTX_reset(ctx);
    160.       OPENSSL_free(ctx);
    161. > }
    162.   
    163.   int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)

ssl/ssl_lib.c:3603:5: 
  3601.       if (*hash)
  3602.           EVP_MD_CTX_free(*hash);
  3603. >     *hash = NULL;
  3604.   }
  3605.   

ssl/ssl_lib.c:3604:1: return from a call to ssl_clear_hash_ctx
  3602.           EVP_MD_CTX_free(*hash);
  3603.       *hash = NULL;
  3604. > }
  3605.   
  3606.   /* Retrieve handshake hashes */

ssl/ssl_lib.c:3589:5: 
3587.   {
3588.       ssl_clear_hash_ctx(hash);
3589. >     *hash = EVP_MD_CTX_new();
3590.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
3591.           EVP_MD_CTX_free(*hash);

crypto/evp/digest.c:152:1: start of procedure EVP_MD_CTX_new()
  150.   }
  151.   
  152. > EVP_MD_CTX *EVP_MD_CTX_new(void)
  153.   {
  154.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));

crypto/evp/digest.c:154:5: 
  152.   EVP_MD_CTX *EVP_MD_CTX_new(void)
  153.   {
  154. >     return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  155.   }
  156.   

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

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

crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
      117.   }
      118.   
      119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121.       void *ret = NULL;

crypto/mem.c:121:5: 
      119.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121. >     void *ret = NULL;
      122.   
      123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:123:9: Taking false branch
      121.       void *ret = NULL;
      122.   
      123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      124.           return malloc_impl(num, file, line);
      125.   

crypto/mem.c:126:9: Taking false branch
      124.           return malloc_impl(num, file, line);
      125.   
      126.       if (num <= 0)
                     ^
      127.           return NULL;
      128.   

crypto/mem.c:129:5: 
      127.           return NULL;
      128.   
      129. >     allow_customize = 0;
      130.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      131.       if (call_malloc_debug) {

crypto/mem.c:139:5: 
      137.       }
      138.   #else
      139. >     (void)file;
      140.       (void)line;
      141.       ret = malloc(num);

crypto/mem.c:140:5: 
      138.   #else
      139.       (void)file;
      140. >     (void)line;
      141.       ret = malloc(num);
      142.   #endif

crypto/mem.c:141:5: 
      139.       (void)file;
      140.       (void)line;
      141. >     ret = malloc(num);
      142.   #endif
      143.   

crypto/mem.c:156:5: 
      154.   #endif
      155.   
      156. >     return ret;
      157.   }
      158.   

crypto/mem.c:157:1: return from a call to CRYPTO_malloc
      155.   
      156.       return ret;
      157. > }
      158.   
      159.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:163:9: Taking true branch
    161.       void *ret = CRYPTO_malloc(num, file, line);
    162.   
    163.       if (ret != NULL)
                   ^
    164.           memset(ret, 0, num);
    165.       return ret;

crypto/mem.c:164:9: 
    162.   
    163.       if (ret != NULL)
    164. >         memset(ret, 0, num);
    165.       return ret;
    166.   }

crypto/mem.c:165:5: 
    163.       if (ret != NULL)
    164.           memset(ret, 0, num);
    165. >     return ret;
    166.   }
    167.   

crypto/mem.c:166:1: return from a call to CRYPTO_zalloc
    164.           memset(ret, 0, num);
    165.       return ret;
    166. > }
    167.   
    168.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:155:1: return from a call to EVP_MD_CTX_new
  153.   {
  154.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  155. > }
  156.   
  157.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)

ssl/ssl_lib.c:3590:9: Taking false branch
3588.       ssl_clear_hash_ctx(hash);
3589.       *hash = EVP_MD_CTX_new();
3590.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
                ^
3591.           EVP_MD_CTX_free(*hash);
3592.           *hash = NULL;

ssl/ssl_lib.c:3590:27: Taking true branch
3588.       ssl_clear_hash_ctx(hash);
3589.       *hash = EVP_MD_CTX_new();
3590.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
                                  ^
3591.           EVP_MD_CTX_free(*hash);
3592.           *hash = NULL;

ssl/ssl_lib.c:3590:33: Taking true branch
3588.       ssl_clear_hash_ctx(hash);
3589.       *hash = EVP_MD_CTX_new();
3590.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
                                        ^
3591.           EVP_MD_CTX_free(*hash);
3592.           *hash = NULL;

ssl/ssl_lib.c:3591:9: 
3589.       *hash = EVP_MD_CTX_new();
3590.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
3591. >         EVP_MD_CTX_free(*hash);
3592.           *hash = NULL;
3593.           return NULL;

crypto/evp/digest.c:157:1: start of procedure EVP_MD_CTX_free()
  155.   }
  156.   
  157. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  158.   {
  159.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:159:5: Skipping EVP_MD_CTX_reset(): empty list of specs
  157.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  158.   {
  159.       EVP_MD_CTX_reset(ctx);
             ^
  160.       OPENSSL_free(ctx);
  161.   }

crypto/evp/digest.c:160:5: 
  158.   {
  159.       EVP_MD_CTX_reset(ctx);
  160. >     OPENSSL_free(ctx);
  161.   }
  162.   

crypto/mem.c:225:1: start of procedure CRYPTO_free()
    223.   }
    224.   
    225. > void CRYPTO_free(void *str, const char *file, int line)
    226.   {
    227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:227:9: Taking true branch
    225.   void CRYPTO_free(void *str, const char *file, int line)
    226.   {
    227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    228.           free_impl(str, file, line);
    229.           return;

crypto/mem.c:227:30: Taking true branch
    225.   void CRYPTO_free(void *str, const char *file, int line)
    226.   {
    227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    228.           free_impl(str, file, line);
    229.           return;

crypto/mem.c:228:9: Skipping __function_pointer__(): unresolved function pointer
    226.   {
    227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    228.           free_impl(str, file, line);
                   ^
    229.           return;
    230.       }

crypto/mem.c:229:9: 
    227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    228.           free_impl(str, file, line);
    229. >         return;
    230.       }
    231.   

crypto/mem.c:243:1: return from a call to CRYPTO_free
    241.       free(str);
    242.   #endif
    243. > }
    244.   
    245.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:161:1: return from a call to EVP_MD_CTX_free
  159.       EVP_MD_CTX_reset(ctx);
  160.       OPENSSL_free(ctx);
  161. > }
  162.   
  163.   int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)

ssl/ssl_lib.c:3592:9: 
3590.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
3591.           EVP_MD_CTX_free(*hash);
3592. >         *hash = NULL;
3593.           return NULL;
3594.       }

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    if (*hash)\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    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    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    (void)file;\n    (void)line;\n    ret = malloc(num);\n#endif\n#ifndef OPENSSL_CPUID_OBJ\n    if (ret && (num > 2048)) {\n        extern unsigned char cleanse_ctr;\n        ((unsigned char *)ret)[0] = cleanse_ctr;\n    }\n#endif\n    return ret;\n}']