test/evp_test.c:690: error: MEMORY_LEAK
  memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 668, column 12 is not reachable after line 690, column 5.
Showing all 38 steps of the trace


test/evp_test.c:660:1: start of procedure digest_test_run()
658.   }
659.   
660. > static int digest_test_run(struct evp_test *t)
661.   {
662.       struct digest_data *mdata = t->data;

test/evp_test.c:662:5: 
660.   static int digest_test_run(struct evp_test *t)
661.   {
662. >     struct digest_data *mdata = t->data;
663.       size_t i;
664.       const char *err = "INTERNAL_ERROR";

test/evp_test.c:664:5: 
662.       struct digest_data *mdata = t->data;
663.       size_t i;
664. >     const char *err = "INTERNAL_ERROR";
665.       EVP_MD_CTX *mctx;
666.       unsigned char md[EVP_MAX_MD_SIZE];

test/evp_test.c:668:5: 
666.       unsigned char md[EVP_MAX_MD_SIZE];
667.       unsigned int md_len;
668. >     mctx = EVP_MD_CTX_new();
669.       if (!mctx)
670.           goto err;

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:98:1: start of procedure CRYPTO_zalloc()
    96.   }
    97.   
    98. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    99.   {
    100.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:100:5: 
    98.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    99.   {
    100. >     void *ret = CRYPTO_malloc(num, file, line);
    101.   
    102.       if (ret != NULL)

crypto/mem.c:71:1: start of procedure CRYPTO_malloc()
      69.   }
      70.   
      71. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      72.   {
      73.       void *ret = NULL;

crypto/mem.c:73:5: 
      71.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      72.   {
      73. >     void *ret = NULL;
      74.   
      75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:75:9: Taking false branch
      73.       void *ret = NULL;
      74.   
      75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                    ^
      76.           return malloc_impl(num, file, line);
      77.   

crypto/mem.c:78:9: Taking false branch
      76.           return malloc_impl(num, file, line);
      77.   
      78.       if (num <= 0)
                    ^
      79.           return NULL;
      80.   

crypto/mem.c:81:5: 
      79.           return NULL;
      80.   
      81. >     allow_customize = 0;
      82.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      83.       if (call_malloc_debug) {

crypto/mem.c:91:5: 
      89.       }
      90.   #else
      91. >     osslargused(file); osslargused(line);
      92.       ret = malloc(num);
      93.   #endif

crypto/mem.c:91:24: 
      89.       }
      90.   #else
      91. >     osslargused(file); osslargused(line);
      92.       ret = malloc(num);
      93.   #endif

crypto/mem.c:92:5: 
      90.   #else
      91.       osslargused(file); osslargused(line);
      92. >     ret = malloc(num);
      93.   #endif
      94.   

crypto/mem.c:95:5: 
      93.   #endif
      94.   
      95. >     return ret;
      96.   }
      97.   

crypto/mem.c:96:1: return from a call to CRYPTO_malloc
      94.   
      95.       return ret;
      96. > }
      97.   
      98.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:102:9: Taking true branch
    100.       void *ret = CRYPTO_malloc(num, file, line);
    101.   
    102.       if (ret != NULL)
                   ^
    103.           memset(ret, 0, num);
    104.       return ret;

crypto/mem.c:103:9: 
    101.   
    102.       if (ret != NULL)
    103. >         memset(ret, 0, num);
    104.       return ret;
    105.   }

crypto/mem.c:104:5: 
    102.       if (ret != NULL)
    103.           memset(ret, 0, num);
    104. >     return ret;
    105.   }
    106.   

crypto/mem.c:105:1: return from a call to CRYPTO_zalloc
    103.           memset(ret, 0, num);
    104.       return ret;
    105. > }
    106.   
    107.   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)

test/evp_test.c:669:10: Taking false branch
667.       unsigned int md_len;
668.       mctx = EVP_MD_CTX_new();
669.       if (!mctx)
                ^
670.           goto err;
671.       err = "DIGESTINIT_ERROR";

test/evp_test.c:671:5: 
669.       if (!mctx)
670.           goto err;
671. >     err = "DIGESTINIT_ERROR";
672.       if (!EVP_DigestInit_ex(mctx, mdata->digest, NULL))
673.           goto err;

test/evp_test.c:672:10: Taking true branch
670.           goto err;
671.       err = "DIGESTINIT_ERROR";
672.       if (!EVP_DigestInit_ex(mctx, mdata->digest, NULL))
                ^
673.           goto err;
674.       err = "DIGESTUPDATE_ERROR";

test/evp_test.c:689:2: 
687.           goto err;
688.       err = NULL;
689. >  err:
690.       EVP_MD_CTX_free(mctx);
691.       t->err = err;

test/evp_test.c:690:5: 
688.       err = NULL;
689.    err:
690. >     EVP_MD_CTX_free(mctx);
691.       t->err = err;
692.       return 1;

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:163:1: start of procedure CRYPTO_free()
    161.   }
    162.   
    163. > void CRYPTO_free(void *str, const char *file, int line)
    164.   {
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:165:9: Taking true branch
    163.   void CRYPTO_free(void *str, const char *file, int line)
    164.   {
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    166.           free_impl(str, file, line);
    167.           return;

crypto/mem.c:165:30: Taking true branch
    163.   void CRYPTO_free(void *str, const char *file, int line)
    164.   {
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    166.           free_impl(str, file, line);
    167.           return;

crypto/mem.c:166:9: Skipping __function_pointer__(): unresolved function pointer
    164.   {
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    166.           free_impl(str, file, line);
                   ^
    167.           return;
    168.       }

crypto/mem.c:167:9: 
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    166.           free_impl(str, file, line);
    167. >         return;
    168.       }
    169.   

crypto/mem.c:181:1: return from a call to CRYPTO_free
    179.       free(str);
    180.   #endif
    181. > }
    182.   
    183.   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)

static int digest_test_run(struct evp_test *t)
{
    struct digest_data *mdata = t->data;
    size_t i;
    const char *err = "INTERNAL_ERROR";
    EVP_MD_CTX *mctx;
    unsigned char md[EVP_MAX_MD_SIZE];
    unsigned int md_len;
    mctx = EVP_MD_CTX_new();
    if (!mctx)
        goto err;
    err = "DIGESTINIT_ERROR";
    if (!EVP_DigestInit_ex(mctx, mdata->digest, NULL))
        goto err;
    err = "DIGESTUPDATE_ERROR";
    for (i = 0; i < mdata->nrpt; i++) {
        if (!EVP_DigestUpdate(mctx, mdata->input, mdata->input_len))
            goto err;
    }
    err = "DIGESTFINAL_ERROR";
    if (!EVP_DigestFinal(mctx, md, &md_len))
        goto err;
    err = "DIGEST_LENGTH_MISMATCH";
    if (md_len != mdata->output_len)
        goto err;
    err = "DIGEST_MISMATCH";
    if (check_output(t, mdata->output, md, md_len))
        goto err;
    err = NULL;
 err:
    EVP_MD_CTX_free(mctx);
    t->err = err;
    return 1;
}
['static int digest_test_run(struct evp_test *t)\n{\n    struct digest_data *mdata = t->data;\n    size_t i;\n    const char *err = "INTERNAL_ERROR";\n    EVP_MD_CTX *mctx;\n    unsigned char md[EVP_MAX_MD_SIZE];\n    unsigned int md_len;\n    mctx = EVP_MD_CTX_new();\n    if (!mctx)\n        goto err;\n    err = "DIGESTINIT_ERROR";\n    if (!EVP_DigestInit_ex(mctx, mdata->digest, NULL))\n        goto err;\n    err = "DIGESTUPDATE_ERROR";\n    for (i = 0; i < mdata->nrpt; i++) {\n        if (!EVP_DigestUpdate(mctx, mdata->input, mdata->input_len))\n            goto err;\n    }\n    err = "DIGESTFINAL_ERROR";\n    if (!EVP_DigestFinal(mctx, md, &md_len))\n        goto err;\n    err = "DIGEST_LENGTH_MISMATCH";\n    if (md_len != mdata->output_len)\n        goto err;\n    err = "DIGEST_MISMATCH";\n    if (check_output(t, mdata->output, md, md_len))\n        goto err;\n    err = NULL;\n err:\n    EVP_MD_CTX_free(mctx);\n    t->err = err;\n    return 1;\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}', '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}']