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


test/evp_test.c:1498:1: start of procedure encode_test_init()
1496.   } ENCODE_DATA;
1497.   
1498. > static int encode_test_init(EVP_TEST *t, const char *encoding)
1499.   {
1500.       ENCODE_DATA *edata;

test/evp_test.c:1502:10: 
1500.       ENCODE_DATA *edata;
1501.   
1502. >     if (!TEST_ptr(edata = OPENSSL_zalloc(sizeof(*edata))))
1503.           return 0;
1504.       if (strcmp(encoding, "canonical") == 0) {

crypto/mem.c:197:1: start of procedure CRYPTO_zalloc()
  195.   }
  196.   
  197. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
  198.   {
  199.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:199:5: 
  197.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
  198.   {
  199. >     void *ret = CRYPTO_malloc(num, file, line);
  200.   
  201.       FAILTEST();

crypto/mem.c:169:1: start of procedure CRYPTO_malloc()
    167.   #endif
    168.   
    169. > void *CRYPTO_malloc(size_t num, const char *file, int line)
    170.   {
    171.       void *ret = NULL;

crypto/mem.c:171:5: 
    169.   void *CRYPTO_malloc(size_t num, const char *file, int line)
    170.   {
    171. >     void *ret = NULL;
    172.   
    173.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:173:9: Taking false branch
    171.       void *ret = NULL;
    172.   
    173.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                   ^
    174.           return malloc_impl(num, file, line);
    175.   

crypto/mem.c:176:9: Taking false branch
    174.           return malloc_impl(num, file, line);
    175.   
    176.       if (num == 0)
                   ^
    177.           return NULL;
    178.   

crypto/mem.c:180:5: 
    178.   
    179.       FAILTEST();
    180. >     allow_customize = 0;
    181.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
    182.       if (call_malloc_debug) {

crypto/mem.c:190:5: 
    188.       }
    189.   #else
    190. >     (void)(file); (void)(line);
    191.       ret = malloc(num);
    192.   #endif

crypto/mem.c:190:19: 
    188.       }
    189.   #else
    190. >     (void)(file); (void)(line);
    191.       ret = malloc(num);
    192.   #endif

crypto/mem.c:191:5: 
    189.   #else
    190.       (void)(file); (void)(line);
    191. >     ret = malloc(num);
    192.   #endif
    193.   

crypto/mem.c:194:5: 
    192.   #endif
    193.   
    194. >     return ret;
    195.   }
    196.   

crypto/mem.c:195:1: return from a call to CRYPTO_malloc
    193.   
    194.       return ret;
    195. > }
    196.   
    197.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:202:9: Taking true branch
  200.   
  201.       FAILTEST();
  202.       if (ret != NULL)
                 ^
  203.           memset(ret, 0, num);
  204.       return ret;

crypto/mem.c:203:9: 
  201.       FAILTEST();
  202.       if (ret != NULL)
  203. >         memset(ret, 0, num);
  204.       return ret;
  205.   }

crypto/mem.c:204:5: 
  202.       if (ret != NULL)
  203.           memset(ret, 0, num);
  204. >     return ret;
  205.   }
  206.   

crypto/mem.c:205:1: return from a call to CRYPTO_zalloc
  203.           memset(ret, 0, num);
  204.       return ret;
  205. > }
  206.   
  207.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

test/testutil/tests.c:227:1: start of procedure test_ptr()
  225.   }
  226.   
  227. > int test_ptr(const char *file, int line, const char *s, const void *p)
  228.   {
  229.       if (p != NULL)

test/testutil/tests.c:229:9: Taking true branch
  227.   int test_ptr(const char *file, int line, const char *s, const void *p)
  228.   {
  229.       if (p != NULL)
                 ^
  230.           return 1;
  231.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);

test/testutil/tests.c:230:9: 
  228.   {
  229.       if (p != NULL)
  230. >         return 1;
  231.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  232.       return 0;

test/testutil/tests.c:233:1: return from a call to test_ptr
  231.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  232.       return 0;
  233. > }
  234.   
  235.   int test_true(const char *file, int line, const char *s, int b)

test/evp_test.c:1502:10: Taking false branch
1500.       ENCODE_DATA *edata;
1501.   
1502.       if (!TEST_ptr(edata = OPENSSL_zalloc(sizeof(*edata))))
                 ^
1503.           return 0;
1504.       if (strcmp(encoding, "canonical") == 0) {

test/evp_test.c:1504:9: Taking false branch
1502.       if (!TEST_ptr(edata = OPENSSL_zalloc(sizeof(*edata))))
1503.           return 0;
1504.       if (strcmp(encoding, "canonical") == 0) {
                ^
1505.           edata->encoding = BASE64_CANONICAL_ENCODING;
1506.       } else if (strcmp(encoding, "valid") == 0) {

test/evp_test.c:1506:16: Taking false branch
1504.       if (strcmp(encoding, "canonical") == 0) {
1505.           edata->encoding = BASE64_CANONICAL_ENCODING;
1506.       } else if (strcmp(encoding, "valid") == 0) {
                       ^
1507.           edata->encoding = BASE64_VALID_ENCODING;
1508.       } else if (strcmp(encoding, "invalid") == 0) {

test/evp_test.c:1508:16: Taking false branch
1506.       } else if (strcmp(encoding, "valid") == 0) {
1507.           edata->encoding = BASE64_VALID_ENCODING;
1508.       } else if (strcmp(encoding, "invalid") == 0) {
                       ^
1509.           edata->encoding = BASE64_INVALID_ENCODING;
1510.           if (!TEST_ptr(t->expected_err = OPENSSL_strdup("DECODE_ERROR")))

test/evp_test.c:1513:9: 
1511.               return 0;
1512.       } else {
1513. >         TEST_error("Bad encoding: %s."
1514.                      " Should be one of {canonical, valid, invalid}",
1515.                      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    (void)(file); (void)(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}']