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


ssl/ssl_lib.c:3729:1: start of procedure ssl_replace_hash()
3727.    */
3728.   
3729. > EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md)
3730.   {
3731.       ssl_clear_hash_ctx(hash);

ssl/ssl_lib.c:3731:5: 
3729.   EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md)
3730.   {
3731. >     ssl_clear_hash_ctx(hash);
3732.       *hash = EVP_MD_CTX_new();
3733.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {

ssl/ssl_lib.c:3741:1: start of procedure ssl_clear_hash_ctx()
  3739.   }
  3740.   
  3741. > void ssl_clear_hash_ctx(EVP_MD_CTX **hash)
  3742.   {
  3743.   

ssl/ssl_lib.c:3744:9: Taking true branch
  3742.   {
  3743.   
  3744.       if (*hash)
                  ^
  3745.           EVP_MD_CTX_free(*hash);
  3746.       *hash = NULL;

ssl/ssl_lib.c:3745:9: 
  3743.   
  3744.       if (*hash)
  3745. >         EVP_MD_CTX_free(*hash);
  3746.       *hash = NULL;
  3747.   }

crypto/evp/digest.c:150:1: start of procedure EVP_MD_CTX_free()
    148.   }
    149.   
    150. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
    151.   {
    152.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:152:5: Skipping EVP_MD_CTX_reset(): empty list of specs
    150.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
    151.   {
    152.       EVP_MD_CTX_reset(ctx);
               ^
    153.       OPENSSL_free(ctx);
    154.   }

crypto/evp/digest.c:153:5: 
    151.   {
    152.       EVP_MD_CTX_reset(ctx);
    153. >     OPENSSL_free(ctx);
    154.   }
    155.   

crypto/mem.c:211:1: start of procedure CRYPTO_free()
      209.   }
      210.   
      211. > void CRYPTO_free(void *str, const char *file, int line)
      212.   {
      213.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:213:9: Taking false branch
      211.   void CRYPTO_free(void *str, const char *file, int line)
      212.   {
      213.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                     ^
      214.           free_impl(str, file, line);
      215.           return;

crypto/mem.c:227:5: 
      225.       }
      226.   #else
      227. >     free(str);
      228.   #endif
      229.   }

crypto/mem.c:229:1: return from a call to CRYPTO_free
      227.       free(str);
      228.   #endif
      229. > }
      230.   
      231.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:154:1: return from a call to EVP_MD_CTX_free
    152.       EVP_MD_CTX_reset(ctx);
    153.       OPENSSL_free(ctx);
    154. > }
    155.   
    156.   int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)

ssl/ssl_lib.c:3746:5: 
  3744.       if (*hash)
  3745.           EVP_MD_CTX_free(*hash);
  3746. >     *hash = NULL;
  3747.   }
  3748.   

ssl/ssl_lib.c:3747:1: return from a call to ssl_clear_hash_ctx
  3745.           EVP_MD_CTX_free(*hash);
  3746.       *hash = NULL;
  3747. > }
  3748.   
  3749.   /* Retrieve handshake hashes */

ssl/ssl_lib.c:3732:5: 
3730.   {
3731.       ssl_clear_hash_ctx(hash);
3732. >     *hash = EVP_MD_CTX_new();
3733.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
3734.           EVP_MD_CTX_free(*hash);

crypto/evp/digest.c:145:1: start of procedure EVP_MD_CTX_new()
  143.   }
  144.   
  145. > EVP_MD_CTX *EVP_MD_CTX_new(void)
  146.   {
  147.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));

crypto/evp/digest.c:147:5: 
  145.   EVP_MD_CTX *EVP_MD_CTX_new(void)
  146.   {
  147. >     return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  148.   }
  149.   

crypto/mem.c:146:1: start of procedure CRYPTO_zalloc()
    144.   }
    145.   
    146. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    147.   {
    148.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:148:5: 
    146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    147.   {
    148. >     void *ret = CRYPTO_malloc(num, file, line);
    149.   
    150.       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. >     osslargused(file); osslargused(line);
      140.       ret = malloc(num);
      141.   #endif

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

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

crypto/mem.c:143:5: 
      141.   #endif
      142.   
      143. >     return ret;
      144.   }
      145.   

crypto/mem.c:144:1: return from a call to CRYPTO_malloc
      142.   
      143.       return ret;
      144. > }
      145.   
      146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:150:9: Taking true branch
    148.       void *ret = CRYPTO_malloc(num, file, line);
    149.   
    150.       if (ret != NULL)
                   ^
    151.           memset(ret, 0, num);
    152.       return ret;

crypto/mem.c:151:9: 
    149.   
    150.       if (ret != NULL)
    151. >         memset(ret, 0, num);
    152.       return ret;
    153.   }

crypto/mem.c:152:5: 
    150.       if (ret != NULL)
    151.           memset(ret, 0, num);
    152. >     return ret;
    153.   }
    154.   

crypto/mem.c:153:1: return from a call to CRYPTO_zalloc
    151.           memset(ret, 0, num);
    152.       return ret;
    153. > }
    154.   
    155.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:148:1: return from a call to EVP_MD_CTX_new
  146.   {
  147.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  148. > }
  149.   
  150.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)

ssl/ssl_lib.c:3733:9: Taking false branch
3731.       ssl_clear_hash_ctx(hash);
3732.       *hash = EVP_MD_CTX_new();
3733.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
                ^
3734.           EVP_MD_CTX_free(*hash);
3735.           *hash = NULL;

ssl/ssl_lib.c:3733:27: Taking true branch
3731.       ssl_clear_hash_ctx(hash);
3732.       *hash = EVP_MD_CTX_new();
3733.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
                                  ^
3734.           EVP_MD_CTX_free(*hash);
3735.           *hash = NULL;

ssl/ssl_lib.c:3733:33: Taking true branch
3731.       ssl_clear_hash_ctx(hash);
3732.       *hash = EVP_MD_CTX_new();
3733.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
                                        ^
3734.           EVP_MD_CTX_free(*hash);
3735.           *hash = NULL;

ssl/ssl_lib.c:3734:9: 
3732.       *hash = EVP_MD_CTX_new();
3733.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
3734. >         EVP_MD_CTX_free(*hash);
3735.           *hash = NULL;
3736.           return NULL;

crypto/evp/digest.c:150:1: start of procedure EVP_MD_CTX_free()
  148.   }
  149.   
  150. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  151.   {
  152.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:152:5: Skipping EVP_MD_CTX_reset(): empty list of specs
  150.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  151.   {
  152.       EVP_MD_CTX_reset(ctx);
             ^
  153.       OPENSSL_free(ctx);
  154.   }

crypto/evp/digest.c:153:5: 
  151.   {
  152.       EVP_MD_CTX_reset(ctx);
  153. >     OPENSSL_free(ctx);
  154.   }
  155.   

crypto/mem.c:211:1: start of procedure CRYPTO_free()
    209.   }
    210.   
    211. > void CRYPTO_free(void *str, const char *file, int line)
    212.   {
    213.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:213:9: Taking true branch
    211.   void CRYPTO_free(void *str, const char *file, int line)
    212.   {
    213.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    214.           free_impl(str, file, line);
    215.           return;

crypto/mem.c:213:30: Taking true branch
    211.   void CRYPTO_free(void *str, const char *file, int line)
    212.   {
    213.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    214.           free_impl(str, file, line);
    215.           return;

crypto/mem.c:214:9: Skipping __function_pointer__(): unresolved function pointer
    212.   {
    213.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    214.           free_impl(str, file, line);
                   ^
    215.           return;
    216.       }

crypto/mem.c:215:9: 
    213.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    214.           free_impl(str, file, line);
    215. >         return;
    216.       }
    217.   

crypto/mem.c:229:1: return from a call to CRYPTO_free
    227.       free(str);
    228.   #endif
    229. > }
    230.   
    231.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:154:1: return from a call to EVP_MD_CTX_free
  152.       EVP_MD_CTX_reset(ctx);
  153.       OPENSSL_free(ctx);
  154. > }
  155.   
  156.   int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)

ssl/ssl_lib.c:3735:9: 
3733.       if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
3734.           EVP_MD_CTX_free(*hash);
3735. >         *hash = NULL;
3736.           return NULL;
3737.       }

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    osslargused(file); osslargused(line);\n    ret = malloc(num);\n#endif\n    return ret;\n}']