test/evp_test.c:1496: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_zalloc()` at line 1485, column 10 is not reachable after line 1496, column 9.
Showing all 27 steps of the trace


test/evp_test.c:1481:1: start of procedure encode_test_init()
1479.   } ENCODE_DATA;
1480.   
1481. > static int encode_test_init(EVP_TEST *t, const char *encoding)
1482.   {
1483.       ENCODE_DATA *edata;

test/evp_test.c:1485:10: 
1483.       ENCODE_DATA *edata;
1484.   
1485. >     if (!TEST_ptr(edata = OPENSSL_zalloc(sizeof(*edata))))
1486.           return 0;
1487.       if (strcmp(encoding, "canonical") == 0) {

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)

test/testutil/tests.c:607:1: start of procedure test_ptr()
  605.   }
  606.   
  607. > int test_ptr(const char *file, int line, const char *s, const void *p)
  608.   {
  609.       if (p != NULL)

test/testutil/tests.c:609:9: Taking true branch
  607.   int test_ptr(const char *file, int line, const char *s, const void *p)
  608.   {
  609.       if (p != NULL)
                 ^
  610.           return 1;
  611.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);

test/testutil/tests.c:610:9: 
  608.   {
  609.       if (p != NULL)
  610. >         return 1;
  611.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  612.       return 0;

test/testutil/tests.c:613:1: return from a call to test_ptr
  611.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  612.       return 0;
  613. > }
  614.   
  615.   int test_true(const char *file, int line, const char *s, int b)

test/evp_test.c:1485:10: Taking false branch
1483.       ENCODE_DATA *edata;
1484.   
1485.       if (!TEST_ptr(edata = OPENSSL_zalloc(sizeof(*edata))))
                 ^
1486.           return 0;
1487.       if (strcmp(encoding, "canonical") == 0) {

test/evp_test.c:1487:9: Taking false branch
1485.       if (!TEST_ptr(edata = OPENSSL_zalloc(sizeof(*edata))))
1486.           return 0;
1487.       if (strcmp(encoding, "canonical") == 0) {
                ^
1488.           edata->encoding = BASE64_CANONICAL_ENCODING;
1489.       } else if (strcmp(encoding, "valid") == 0) {

test/evp_test.c:1489:16: Taking false branch
1487.       if (strcmp(encoding, "canonical") == 0) {
1488.           edata->encoding = BASE64_CANONICAL_ENCODING;
1489.       } else if (strcmp(encoding, "valid") == 0) {
                       ^
1490.           edata->encoding = BASE64_VALID_ENCODING;
1491.       } else if (strcmp(encoding, "invalid") == 0) {

test/evp_test.c:1491:16: Taking false branch
1489.       } else if (strcmp(encoding, "valid") == 0) {
1490.           edata->encoding = BASE64_VALID_ENCODING;
1491.       } else if (strcmp(encoding, "invalid") == 0) {
                       ^
1492.           edata->encoding = BASE64_INVALID_ENCODING;
1493.           if (!TEST_ptr(t->expected_err = OPENSSL_strdup("DECODE_ERROR")))

test/evp_test.c:1496:9: 
1494.               return 0;
1495.       } else {
1496. >         TEST_error("Bad encoding: %s."
1497.                      " Should be one of {canonical, valid, invalid}",
1498.                      encoding);

static int encode_test_init(EVP_TEST *t, const char *encoding)
{
    ENCODE_DATA *edata;
    if (!TEST_ptr(edata = OPENSSL_zalloc(sizeof(*edata))))
        return 0;
    if (strcmp(encoding, "canonical") == 0) {
        edata->encoding = BASE64_CANONICAL_ENCODING;
    } else if (strcmp(encoding, "valid") == 0) {
        edata->encoding = BASE64_VALID_ENCODING;
    } else if (strcmp(encoding, "invalid") == 0) {
        edata->encoding = BASE64_INVALID_ENCODING;
        if (!TEST_ptr(t->expected_err = OPENSSL_strdup("DECODE_ERROR")))
            return 0;
    } else {
        TEST_error("Bad encoding: %s."
                   " Should be one of {canonical, valid, invalid}",
                   encoding);
        return 0;
    }
    t->data = edata;
    return 1;
}
['static int encode_test_init(EVP_TEST *t, const char *encoding)\n{\n    ENCODE_DATA *edata;\n    if (!TEST_ptr(edata = OPENSSL_zalloc(sizeof(*edata))))\n        return 0;\n    if (strcmp(encoding, "canonical") == 0) {\n        edata->encoding = BASE64_CANONICAL_ENCODING;\n    } else if (strcmp(encoding, "valid") == 0) {\n        edata->encoding = BASE64_VALID_ENCODING;\n    } else if (strcmp(encoding, "invalid") == 0) {\n        edata->encoding = BASE64_INVALID_ENCODING;\n        if (!TEST_ptr(t->expected_err = OPENSSL_strdup("DECODE_ERROR")))\n            return 0;\n    } else {\n        TEST_error("Bad encoding: %s."\n                   " Should be one of {canonical, valid, invalid}",\n                   encoding);\n        return 0;\n    }\n    t->data = edata;\n    return 1;\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}']