test/sha1test.c:65: error: MEMORY_LEAK
  memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 52, column 9 is not reachable after line 65, column 5.
Showing all 76 steps of the trace


test/sha1test.c:45:1: start of procedure test_sha1()
43.   }
44.   
45. > static int test_sha1(int i)
46.   {
47.       EVP_MD_CTX *c;

test/sha1test.c:49:5: 
47.       EVP_MD_CTX *c;
48.       unsigned char md[SHA_DIGEST_LENGTH];
49. >     const size_t tlen = strlen(test[i]);
50.       int testresult = 0;
51.   

test/sha1test.c:50:5: 
48.       unsigned char md[SHA_DIGEST_LENGTH];
49.       const size_t tlen = strlen(test[i]);
50. >     int testresult = 0;
51.   
52.       c = EVP_MD_CTX_new();

test/sha1test.c:52:5: 
50.       int testresult = 0;
51.   
52. >     c = EVP_MD_CTX_new();
53.       if (!TEST_ptr(c))
54.           goto end;

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/sha1test.c:53:10: 
51.   
52.       c = EVP_MD_CTX_new();
53. >     if (!TEST_ptr(c))
54.           goto end;
55.   

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/sha1test.c:53:10: Taking false branch
51.   
52.       c = EVP_MD_CTX_new();
53.       if (!TEST_ptr(c))
               ^
54.           goto end;
55.   

test/sha1test.c:59:10: 
57.       ebcdic2ascii(test[i], test[i], tlen);
58.   # endif
59. >     if (!TEST_true(EVP_Digest(test[i], tlen, md, NULL, EVP_sha1(), NULL))
60.           || !TEST_str_eq(pt(md), ret[i]))
61.           goto end;

crypto/evp/m_sha1.c:108:1: start of procedure EVP_sha1()
  106.   };
  107.   
  108. > const EVP_MD *EVP_sha1(void)
  109.   {
  110.       return (&sha1_md);

crypto/evp/m_sha1.c:110:5: 
  108.   const EVP_MD *EVP_sha1(void)
  109.   {
  110. >     return (&sha1_md);
  111.   }
  112.   

crypto/evp/m_sha1.c:111:1: return from a call to EVP_sha1
  109.   {
  110.       return (&sha1_md);
  111. > }
  112.   
  113.   static int init224(EVP_MD_CTX *ctx)

test/sha1test.c:59:10: Condition is true
57.       ebcdic2ascii(test[i], test[i], tlen);
58.   # endif
59.       if (!TEST_true(EVP_Digest(test[i], tlen, md, NULL, EVP_sha1(), NULL))
               ^
60.           || !TEST_str_eq(pt(md), ret[i]))
61.           goto end;

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 true 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:414:9: 
  412.   {
  413.       if (b)
  414. >         return 1;
  415.       test_fail_message(NULL, file, line, "bool", s, "true", "==", "false");
  416.       return 0;

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/sha1test.c:59:10: Taking false branch
57.       ebcdic2ascii(test[i], test[i], tlen);
58.   # endif
59.       if (!TEST_true(EVP_Digest(test[i], tlen, md, NULL, EVP_sha1(), NULL))
               ^
60.           || !TEST_str_eq(pt(md), ret[i]))
61.           goto end;

test/sha1test.c:60:13: 
58.   # endif
59.       if (!TEST_true(EVP_Digest(test[i], tlen, md, NULL, EVP_sha1(), NULL))
60. >         || !TEST_str_eq(pt(md), ret[i]))
61.           goto end;
62.   

test/sha1test.c:35:1: start of procedure pt()
  33.   static char *bigret = "34aa973cd4c4daa4f61eeb2bdbad27316534016f";
  34.   
  35. > static char *pt(unsigned char *md)
  36.   {
  37.       int i;

test/sha1test.c:40:10: 
  38.       static char buf[80];
  39.   
  40. >     for (i = 0; i < SHA_DIGEST_LENGTH; i++)
  41.           sprintf(&(buf[i * 2]), "%02x", md[i]);
  42.       return buf;

test/sha1test.c:40:17: Loop condition is true. Entering loop body
  38.       static char buf[80];
  39.   
  40.       for (i = 0; i < SHA_DIGEST_LENGTH; i++)
                        ^
  41.           sprintf(&(buf[i * 2]), "%02x", md[i]);
  42.       return buf;

test/sha1test.c:41:9: 
  39.   
  40.       for (i = 0; i < SHA_DIGEST_LENGTH; i++)
  41. >         sprintf(&(buf[i * 2]), "%02x", md[i]);
  42.       return buf;
  43.   }

test/sha1test.c:40:40: 
  38.       static char buf[80];
  39.   
  40. >     for (i = 0; i < SHA_DIGEST_LENGTH; i++)
  41.           sprintf(&(buf[i * 2]), "%02x", md[i]);
  42.       return buf;

test/sha1test.c:40:17: Loop condition is true. Entering loop body
  38.       static char buf[80];
  39.   
  40.       for (i = 0; i < SHA_DIGEST_LENGTH; i++)
                        ^
  41.           sprintf(&(buf[i * 2]), "%02x", md[i]);
  42.       return buf;

test/sha1test.c:41:9: 
  39.   
  40.       for (i = 0; i < SHA_DIGEST_LENGTH; i++)
  41. >         sprintf(&(buf[i * 2]), "%02x", md[i]);
  42.       return buf;
  43.   }

test/sha1test.c:40:40: 
  38.       static char buf[80];
  39.   
  40. >     for (i = 0; i < SHA_DIGEST_LENGTH; i++)
  41.           sprintf(&(buf[i * 2]), "%02x", md[i]);
  42.       return buf;

test/sha1test.c:40:17: Loop condition is true. Entering loop body
  38.       static char buf[80];
  39.   
  40.       for (i = 0; i < SHA_DIGEST_LENGTH; i++)
                        ^
  41.           sprintf(&(buf[i * 2]), "%02x", md[i]);
  42.       return buf;

test/sha1test.c:41:9: 
  39.   
  40.       for (i = 0; i < SHA_DIGEST_LENGTH; i++)
  41. >         sprintf(&(buf[i * 2]), "%02x", md[i]);
  42.       return buf;
  43.   }

test/sha1test.c:40:40: 
  38.       static char buf[80];
  39.   
  40. >     for (i = 0; i < SHA_DIGEST_LENGTH; i++)
  41.           sprintf(&(buf[i * 2]), "%02x", md[i]);
  42.       return buf;

test/sha1test.c:40:17: Loop condition is false. Leaving loop
  38.       static char buf[80];
  39.   
  40.       for (i = 0; i < SHA_DIGEST_LENGTH; i++)
                        ^
  41.           sprintf(&(buf[i * 2]), "%02x", md[i]);
  42.       return buf;

test/sha1test.c:42:5: 
  40.       for (i = 0; i < SHA_DIGEST_LENGTH; i++)
  41.           sprintf(&(buf[i * 2]), "%02x", md[i]);
  42. >     return buf;
  43.   }
  44.   

test/sha1test.c:43:1: return from a call to pt
  41.           sprintf(&(buf[i * 2]), "%02x", md[i]);
  42.       return buf;
  43. > }
  44.   
  45.   static int test_sha1(int i)

test/testutil/tests.c:427:1: start of procedure test_str_eq()
  425.   }
  426.   
  427. > int test_str_eq(const char *file, int line, const char *st1, const char *st2,
  428.                   const char *s1, const char *s2)
  429.   {

test/testutil/tests.c:430:9: Taking true branch
  428.                   const char *s1, const char *s2)
  429.   {
  430.       if (s1 == NULL && s2 == NULL)
                 ^
  431.         return 1;
  432.       if (s1 == NULL || s2 == NULL || strcmp(s1, s2) != 0) {

test/testutil/tests.c:430:23: Taking false branch
  428.                   const char *s1, const char *s2)
  429.   {
  430.       if (s1 == NULL && s2 == NULL)
                               ^
  431.         return 1;
  432.       if (s1 == NULL || s2 == NULL || strcmp(s1, s2) != 0) {

test/testutil/tests.c:432:9: Taking true branch
  430.       if (s1 == NULL && s2 == NULL)
  431.         return 1;
  432.       if (s1 == NULL || s2 == NULL || strcmp(s1, s2) != 0) {
                 ^
  433.           test_fail_string_message(NULL, file, line, "string", st1, st2, "==",
  434.                                    s1, s1 == NULL ? 0 : strlen(s1),

test/testutil/tests.c:434:38: Condition is true
  432.       if (s1 == NULL || s2 == NULL || strcmp(s1, s2) != 0) {
  433.           test_fail_string_message(NULL, file, line, "string", st1, st2, "==",
  434.                                    s1, s1 == NULL ? 0 : strlen(s1),
                                              ^
  435.                                    s2, s2 == NULL ? 0 : strlen(s2));
  436.           return 0;

test/testutil/tests.c:435:38: Condition is false
  433.           test_fail_string_message(NULL, file, line, "string", st1, st2, "==",
  434.                                    s1, s1 == NULL ? 0 : strlen(s1),
  435.                                    s2, s2 == NULL ? 0 : strlen(s2));
                                              ^
  436.           return 0;
  437.       }

test/testutil/tests.c:433:9: Skipping test_fail_string_message(): empty list of specs
  431.         return 1;
  432.       if (s1 == NULL || s2 == NULL || strcmp(s1, s2) != 0) {
  433.           test_fail_string_message(NULL, file, line, "string", st1, st2, "==",
                 ^
  434.                                    s1, s1 == NULL ? 0 : strlen(s1),
  435.                                    s2, s2 == NULL ? 0 : strlen(s2));

test/testutil/tests.c:436:9: 
  434.                                    s1, s1 == NULL ? 0 : strlen(s1),
  435.                                    s2, s2 == NULL ? 0 : strlen(s2));
  436. >         return 0;
  437.       }
  438.       return 1;

test/testutil/tests.c:439:1: return from a call to test_str_eq
  437.       }
  438.       return 1;
  439. > }
  440.   
  441.   int test_str_ne(const char *file, int line, const char *st1, const char *st2,

test/sha1test.c:60:13: Taking true branch
58.   # endif
59.       if (!TEST_true(EVP_Digest(test[i], tlen, md, NULL, EVP_sha1(), NULL))
60.           || !TEST_str_eq(pt(md), ret[i]))
                  ^
61.           goto end;
62.   

test/sha1test.c:64:2: 
62.   
63.       testresult = 1;
64. >  end:
65.       EVP_MD_CTX_free(c);
66.       return testresult;

test/sha1test.c:65:5: 
63.       testresult = 1;
64.    end:
65. >     EVP_MD_CTX_free(c);
66.       return testresult;
67.   }

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)
