crypto/evp/digest.c:284: error: MEMORY_LEAK
  memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 275, column 23 is not reachable after line 284, column 5.
Showing all 40 steps of the trace


crypto/evp/digest.c:271:1: start of procedure EVP_Digest()
269.   }
270.   
271. > int EVP_Digest(const void *data, size_t count,
272.                  unsigned char *md, unsigned int *size, const EVP_MD *type,
273.                  ENGINE *impl)

crypto/evp/digest.c:275:5: 
273.                  ENGINE *impl)
274.   {
275. >     EVP_MD_CTX *ctx = EVP_MD_CTX_new();
276.       int ret;
277.   

crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_new()
  47.   }
  48.   
  49. > EVP_MD_CTX *EVP_MD_CTX_new(void)
  50.   {
  51.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));

crypto/evp/digest.c:51:5: 
  49.   EVP_MD_CTX *EVP_MD_CTX_new(void)
  50.   {
  51. >     return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  52.   }
  53.   

crypto/mem.c:228:1: start of procedure CRYPTO_zalloc()
    226.   }
    227.   
    228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    229.   {
    230.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:230:5: 
    228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    229.   {
    230. >     void *ret = CRYPTO_malloc(num, file, line);
    231.   
    232.       FAILTEST();

crypto/mem.c:192:1: start of procedure CRYPTO_malloc()
      190.   #endif
      191.   
      192. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      193.   {
      194.       void *ret = NULL;

crypto/mem.c:194:5: 
      192.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      193.   {
      194. >     void *ret = NULL;
      195.   
      196.       INCREMENT(malloc_count);

crypto/mem.c:197:9: Taking false branch
      195.   
      196.       INCREMENT(malloc_count);
      197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      198.           return malloc_impl(num, file, line);
      199.   

crypto/mem.c:200:9: Taking false branch
      198.           return malloc_impl(num, file, line);
      199.   
      200.       if (num == 0)
                     ^
      201.           return NULL;
      202.   

crypto/mem.c:204:9: Taking true branch
      202.   
      203.       FAILTEST();
      204.       if (allow_customize) {
                     ^
      205.           /*
      206.            * Disallow customization after the first allocation. We only set this

crypto/mem.c:210:9: 
      208.            * allocation.
      209.            */
      210. >         allow_customize = 0;
      211.       }
      212.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG

crypto/mem.c:221:5: 
      219.       }
      220.   #else
      221. >     (void)(file); (void)(line);
      222.       ret = malloc(num);
      223.   #endif

crypto/mem.c:221:19: 
      219.       }
      220.   #else
      221. >     (void)(file); (void)(line);
      222.       ret = malloc(num);
      223.   #endif

crypto/mem.c:222:5: 
      220.   #else
      221.       (void)(file); (void)(line);
      222. >     ret = malloc(num);
      223.   #endif
      224.   

crypto/mem.c:225:5: 
      223.   #endif
      224.   
      225. >     return ret;
      226.   }
      227.   

crypto/mem.c:226:1: return from a call to CRYPTO_malloc
      224.   
      225.       return ret;
      226. > }
      227.   
      228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:233:9: Taking true branch
    231.   
    232.       FAILTEST();
    233.       if (ret != NULL)
                   ^
    234.           memset(ret, 0, num);
    235.       return ret;

crypto/mem.c:234:9: 
    232.       FAILTEST();
    233.       if (ret != NULL)
    234. >         memset(ret, 0, num);
    235.       return ret;
    236.   }

crypto/mem.c:235:5: 
    233.       if (ret != NULL)
    234.           memset(ret, 0, num);
    235. >     return ret;
    236.   }
    237.   

crypto/mem.c:236:1: return from a call to CRYPTO_zalloc
    234.           memset(ret, 0, num);
    235.       return ret;
    236. > }
    237.   
    238.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:52:1: return from a call to EVP_MD_CTX_new
  50.   {
  51.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  52. > }
  53.   
  54.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)

crypto/evp/digest.c:278:9: Taking false branch
276.       int ret;
277.   
278.       if (ctx == NULL)
               ^
279.           return 0;
280.       EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_ONESHOT);

crypto/evp/digest.c:280:5: 
278.       if (ctx == NULL)
279.           return 0;
280. >     EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_ONESHOT);
281.       ret = EVP_DigestInit_ex(ctx, type, impl)
282.           && EVP_DigestUpdate(ctx, data, count)

crypto/evp/evp_lib.c:488:1: start of procedure EVP_MD_CTX_set_flags()
  486.   }
  487.   
  488. > void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags)
  489.   {
  490.       ctx->flags |= flags;

crypto/evp/evp_lib.c:490:5: 
  488.   void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags)
  489.   {
  490. >     ctx->flags |= flags;
  491.   }
  492.   

crypto/evp/evp_lib.c:491:1: return from a call to EVP_MD_CTX_set_flags
  489.   {
  490.       ctx->flags |= flags;
  491. > }
  492.   
  493.   void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags)

crypto/evp/digest.c:281:11: Condition is false
279.           return 0;
280.       EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_ONESHOT);
281.       ret = EVP_DigestInit_ex(ctx, type, impl)
                 ^
282.           && EVP_DigestUpdate(ctx, data, count)
283.           && EVP_DigestFinal_ex(ctx, md, size);

crypto/evp/digest.c:281:5: 
279.           return 0;
280.       EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_ONESHOT);
281. >     ret = EVP_DigestInit_ex(ctx, type, impl)
282.           && EVP_DigestUpdate(ctx, data, count)
283.           && EVP_DigestFinal_ex(ctx, md, size);

crypto/evp/digest.c:284:5: 
282.           && EVP_DigestUpdate(ctx, data, count)
283.           && EVP_DigestFinal_ex(ctx, md, size);
284. >     EVP_MD_CTX_free(ctx);
285.   
286.       return ret;

crypto/evp/digest.c:54:1: start of procedure EVP_MD_CTX_free()
  52.   }
  53.   
  54. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  55.   {
  56.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:56:5: Skipping EVP_MD_CTX_reset(): empty list of specs
  54.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  55.   {
  56.       EVP_MD_CTX_reset(ctx);
            ^
  57.       OPENSSL_free(ctx);
  58.   }

crypto/evp/digest.c:57:5: 
  55.   {
  56.       EVP_MD_CTX_reset(ctx);
  57. >     OPENSSL_free(ctx);
  58.   }
  59.   

crypto/mem.c:295:1: start of procedure CRYPTO_free()
    293.   }
    294.   
    295. > void CRYPTO_free(void *str, const char *file, int line)
    296.   {
    297.       INCREMENT(free_count);

crypto/mem.c:298:9: Taking true branch
    296.   {
    297.       INCREMENT(free_count);
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    299.           free_impl(str, file, line);
    300.           return;

crypto/mem.c:298:30: Taking true branch
    296.   {
    297.       INCREMENT(free_count);
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    299.           free_impl(str, file, line);
    300.           return;

crypto/mem.c:299:9: Skipping __function_pointer__(): unresolved function pointer
    297.       INCREMENT(free_count);
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    299.           free_impl(str, file, line);
                   ^
    300.           return;
    301.       }

crypto/mem.c:300:9: 
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    299.           free_impl(str, file, line);
    300. >         return;
    301.       }
    302.   

crypto/mem.c:314:1: return from a call to CRYPTO_free
    312.       free(str);
    313.   #endif
    314. > }
    315.   
    316.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:58:1: return from a call to EVP_MD_CTX_free
  56.       EVP_MD_CTX_reset(ctx);
  57.       OPENSSL_free(ctx);
  58. > }
  59.   
  60.   int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)

int EVP_Digest(const void *data, size_t count,
               unsigned char *md, unsigned int *size, const EVP_MD *type,
               ENGINE *impl)
{
    EVP_MD_CTX *ctx = EVP_MD_CTX_new();
    int ret;
    if (ctx == NULL)
        return 0;
    EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_ONESHOT);
    ret = EVP_DigestInit_ex(ctx, type, impl)
        && EVP_DigestUpdate(ctx, data, count)
        && EVP_DigestFinal_ex(ctx, md, size);
    EVP_MD_CTX_free(ctx);
    return ret;
}
['int EVP_Digest(const void *data, size_t count,\n               unsigned char *md, unsigned int *size, const EVP_MD *type,\n               ENGINE *impl)\n{\n    EVP_MD_CTX *ctx = EVP_MD_CTX_new();\n    int ret;\n    if (ctx == NULL)\n        return 0;\n    EVP_MD_CTX_set_flags(ctx, EVP_MD_CTX_FLAG_ONESHOT);\n    ret = EVP_DigestInit_ex(ctx, type, impl)\n        && EVP_DigestUpdate(ctx, data, count)\n        && EVP_DigestFinal_ex(ctx, md, size);\n    EVP_MD_CTX_free(ctx);\n    return ret;\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    INCREMENT(malloc_count);\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    if (allow_customize) {\n        allow_customize = 0;\n    }\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); (void)(line);\n    ret = malloc(num);\n#endif\n    return ret;\n}', 'void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags)\n{\n    ctx->flags |= flags;\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    INCREMENT(free_count);\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}']