test/sha512t.c:128: error: MEMORY_LEAK
  memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 112, column 11 is not reachable after line 128, column 5.
Showing all 57 steps of the trace


test/sha512t.c:97:1: start of procedure test_sha512_multi()
95.   }
96.   
97. > static int test_sha512_multi(void)
98.   {
99.       unsigned char md[SHA512_DIGEST_LENGTH];

test/sha512t.c:100:5: 
98.   {
99.       unsigned char md[SHA512_DIGEST_LENGTH];
100. >     int i, testresult = 0;
101.       EVP_MD_CTX *evp;
102.       static const char *updstr = "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa"

test/sha512t.c:102:5: 
100.       int i, testresult = 0;
101.       EVP_MD_CTX *evp;
102. >     static const char *updstr = "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa"
103.                                   "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa"
104.                                   "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa"

test/sha512t.c:112:5: 
110.                                   "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa";
111.   
112. >     evp = EVP_MD_CTX_new();
113.       if (!TEST_ptr(evp))
114.           return 0;

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)

test/sha512t.c:113:10: 
111.   
112.       evp = EVP_MD_CTX_new();
113. >     if (!TEST_ptr(evp))
114.           return 0;
115.       if (!TEST_true(EVP_DigestInit_ex(evp, EVP_sha512(), NULL)))

test/testutil/tests.c:403:1: start of procedure test_ptr()
  401.   }
  402.   
  403. > int test_ptr(const char *file, int line, const char *s, const void *p)
  404.   {
  405.       if (p != NULL)

test/testutil/tests.c:405:9: Taking true branch
  403.   int test_ptr(const char *file, int line, const char *s, const void *p)
  404.   {
  405.       if (p != NULL)
                 ^
  406.           return 1;
  407.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);

test/testutil/tests.c:406:9: 
  404.   {
  405.       if (p != NULL)
  406. >         return 1;
  407.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  408.       return 0;

test/testutil/tests.c:409:1: return from a call to test_ptr
  407.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  408.       return 0;
  409. > }
  410.   
  411.   int test_true(const char *file, int line, const char *s, int b)

test/sha512t.c:113:10: Taking false branch
111.   
112.       evp = EVP_MD_CTX_new();
113.       if (!TEST_ptr(evp))
                ^
114.           return 0;
115.       if (!TEST_true(EVP_DigestInit_ex(evp, EVP_sha512(), NULL)))

test/sha512t.c:115:10: 
113.       if (!TEST_ptr(evp))
114.           return 0;
115. >     if (!TEST_true(EVP_DigestInit_ex(evp, EVP_sha512(), NULL)))
116.           goto end;
117.       for (i = 0; i < 1000000; i += 288)

crypto/evp/m_sha1.c:230:1: start of procedure EVP_sha512()
  228.   };
  229.   
  230. > const EVP_MD *EVP_sha512(void)
  231.   {
  232.       return (&sha512_md);

crypto/evp/m_sha1.c:232:5: 
  230.   const EVP_MD *EVP_sha512(void)
  231.   {
  232. >     return (&sha512_md);
  233.   }

crypto/evp/m_sha1.c:233:1: return from a call to EVP_sha512
  231.   {
  232.       return (&sha512_md);
  233. > }

test/sha512t.c:115:10: Condition is false
113.       if (!TEST_ptr(evp))
114.           return 0;
115.       if (!TEST_true(EVP_DigestInit_ex(evp, EVP_sha512(), NULL)))
                ^
116.           goto end;
117.       for (i = 0; i < 1000000; i += 288)

test/testutil/tests.c:411:1: start of procedure test_true()
  409.   }
  410.   
  411. > int test_true(const char *file, int line, const char *s, int b)
  412.   {
  413.       if (b)

test/testutil/tests.c:413:9: Taking false branch
  411.   int test_true(const char *file, int line, const char *s, int b)
  412.   {
  413.       if (b)
                 ^
  414.           return 1;
  415.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");

test/testutil/tests.c:415:5: 
  413.       if (b)
  414.           return 1;
  415. >     test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");
  416.       return 0;
  417.   }

test/testutil/tests.c:288:1: start of procedure test_fail_message()
    286.   }
    287.   
    288. > static void test_fail_message(const char *prefix, const char *file,
    289.                                 int line, const char *type,
    290.                                 const char *left, const char *right,

test/testutil/tests.c:295:5: 
    293.       va_list ap;
    294.   
    295. >     va_start(ap, fmt);
    296.       test_fail_message_va(prefix, file, line, type, left, right, op, fmt, ap);
    297.       va_end(ap);

test/testutil/tests.c:296:5: Skipping test_fail_message_va(): empty list of specs
    294.   
    295.       va_start(ap, fmt);
    296.       test_fail_message_va(prefix, file, line, type, left, right, op, fmt, ap);
               ^
    297.       va_end(ap);
    298.   }

test/testutil/tests.c:297:5: 
    295.       va_start(ap, fmt);
    296.       test_fail_message_va(prefix, file, line, type, left, right, op, fmt, ap);
    297. >     va_end(ap);
    298.   }
    299.   

test/testutil/tests.c:298:1: return from a call to test_fail_message
    296.       test_fail_message_va(prefix, file, line, type, left, right, op, fmt, ap);
    297.       va_end(ap);
    298. > }
    299.   
    300.   void test_info_c90(const char *desc, ...)

test/testutil/tests.c:416:5: 
  414.           return 1;
  415.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");
  416. >     return 0;
  417.   }
  418.   

test/testutil/tests.c:417:1: return from a call to test_true
  415.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");
  416.       return 0;
  417. > }
  418.   
  419.   int test_false(const char *file, int line, const char *s, int b)

test/sha512t.c:115:10: Taking true branch
113.       if (!TEST_ptr(evp))
114.           return 0;
115.       if (!TEST_true(EVP_DigestInit_ex(evp, EVP_sha512(), NULL)))
                ^
116.           goto end;
117.       for (i = 0; i < 1000000; i += 288)

test/sha512t.c:127:2: 
125.   
126.       testresult = 1;
127. >  end:
128.       EVP_MD_CTX_free(evp);
129.       return testresult;

test/sha512t.c:128:5: 
126.       testresult = 1;
127.    end:
128. >     EVP_MD_CTX_free(evp);
129.       return testresult;
130.   }

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)

static int test_sha512_multi(void)
{
    unsigned char md[SHA512_DIGEST_LENGTH];
    int i, testresult = 0;
    EVP_MD_CTX *evp;
    static const char *updstr = "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa"
                                "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa"
                                "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa"
                                "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa"
                                "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa"
                                "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa"
                                "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa"
                                "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa"
                                "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa";
    evp = EVP_MD_CTX_new();
    if (!TEST_ptr(evp))
        return 0;
    if (!TEST_true(EVP_DigestInit_ex(evp, EVP_sha512(), NULL)))
        goto end;
    for (i = 0; i < 1000000; i += 288)
        if (!TEST_true(EVP_DigestUpdate(evp, updstr,
                                        (1000000 - i) < 288 ? 1000000 - i
                                                            : 288)))
            goto end;
    if (!TEST_true(EVP_DigestFinal_ex(evp, md, NULL))
        || !TEST_mem_eq(md, sizeof(md), app_c3, sizeof(app_c3)))
        goto end;
    testresult = 1;
 end:
    EVP_MD_CTX_free(evp);
    return testresult;
}
['static int test_sha512_multi(void)\n{\n    unsigned char md[SHA512_DIGEST_LENGTH];\n    int i, testresult = 0;\n    EVP_MD_CTX *evp;\n    static const char *updstr = "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa"\n                                "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa"\n                                "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa"\n                                "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa"\n                                "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa"\n                                "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa"\n                                "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa"\n                                "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa"\n                                "aaaaaaaa" "aaaaaaaa" "aaaaaaaa" "aaaaaaaa";\n    evp = EVP_MD_CTX_new();\n    if (!TEST_ptr(evp))\n        return 0;\n    if (!TEST_true(EVP_DigestInit_ex(evp, EVP_sha512(), NULL)))\n        goto end;\n    for (i = 0; i < 1000000; i += 288)\n        if (!TEST_true(EVP_DigestUpdate(evp, updstr,\n                                        (1000000 - i) < 288 ? 1000000 - i\n                                                            : 288)))\n            goto end;\n    if (!TEST_true(EVP_DigestFinal_ex(evp, md, NULL))\n        || !TEST_mem_eq(md, sizeof(md), app_c3, sizeof(app_c3)))\n        goto end;\n    testresult = 1;\n end:\n    EVP_MD_CTX_free(evp);\n    return testresult;\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}', 'int test_ptr(const char *file, int line, const char *s, const void *p)\n{\n    if (p != NULL)\n        return 1;\n    test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);\n    return 0;\n}', 'const EVP_MD *EVP_sha512(void)\n{\n    return (&sha512_md);\n}', 'int test_true(const char *file, int line, const char *s, int b)\n{\n    if (b)\n        return 1;\n    test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");\n    return 0;\n}', 'static void test_fail_message(const char *prefix, const char *file,\n                              int line, const char *type,\n                              const char *left, const char *right,\n                              const char *op, const char *fmt, ...)\n{\n    va_list ap;\n    va_start(ap, fmt);\n    test_fail_message_va(prefix, file, line, type, left, right, op, fmt, ap);\n    va_end(ap);\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}']