test/evp_test.c:1695: error: NULL_DEREFERENCE
  pointer `pdat` last assigned on line 1694 could be null and is dereferenced at line 1695, column 5.
Showing all 19 steps of the trace


test/evp_test.c:1675:1: start of procedure pbe_test_init()
1673.   }
1674.   
1675. > static int pbe_test_init(EVP_TEST *t, const char *alg)
1676.   {
1677.       PBE_DATA *pdat;

test/evp_test.c:1678:5: 
1676.   {
1677.       PBE_DATA *pdat;
1678. >     PBE_TYPE pbe_type = PBE_TYPE_INVALID;
1679.   
1680.       if (strcmp(alg, "scrypt") == 0) {

test/evp_test.c:1680:9: Taking false branch
1678.       PBE_TYPE pbe_type = PBE_TYPE_INVALID;
1679.   
1680.       if (strcmp(alg, "scrypt") == 0) {
                ^
1681.   #ifndef OPENSSL_NO_SCRYPT
1682.           pbe_type = PBE_TYPE_SCRYPT;

test/evp_test.c:1687:16: Taking false branch
1685.           return 1;
1686.   #endif
1687.       } else if (strcmp(alg, "pbkdf2") == 0) {
                       ^
1688.           pbe_type = PBE_TYPE_PBKDF2;
1689.       } else if (strcmp(alg, "pkcs12") == 0) {

test/evp_test.c:1689:16: Taking false branch
1687.       } else if (strcmp(alg, "pbkdf2") == 0) {
1688.           pbe_type = PBE_TYPE_PBKDF2;
1689.       } else if (strcmp(alg, "pkcs12") == 0) {
                       ^
1690.           pbe_type = PBE_TYPE_PKCS12;
1691.       } else {

test/evp_test.c:1692:9: Skipping test_error(): empty list of specs
1690.           pbe_type = PBE_TYPE_PKCS12;
1691.       } else {
1692.           TEST_error("Unknown pbe algorithm %s", alg);
                ^
1693.       }
1694.       pdat = OPENSSL_zalloc(sizeof(*pdat));

test/evp_test.c:1694:5: 
1692.           TEST_error("Unknown pbe algorithm %s", alg);
1693.       }
1694. >     pdat = OPENSSL_zalloc(sizeof(*pdat));
1695.       pdat->pbe_type = pbe_type;
1696.       t->data = pdat;

crypto/mem.c:228:1: start of procedure CRYPTO_zalloc()
  226.   }
  227.   
  228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
  229.   {
  230.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:230:5: 
  228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
  229.   {
  230. >     void *ret = CRYPTO_malloc(num, file, line);
  231.   
  232.       FAILTEST();

crypto/mem.c:192:1: start of procedure CRYPTO_malloc()
    190.   #endif
    191.   
    192. > void *CRYPTO_malloc(size_t num, const char *file, int line)
    193.   {
    194.       void *ret = NULL;

crypto/mem.c:194:5: 
    192.   void *CRYPTO_malloc(size_t num, const char *file, int line)
    193.   {
    194. >     void *ret = NULL;
    195.   
    196.       INCREMENT(malloc_count);

crypto/mem.c:197:9: Taking true branch
    195.   
    196.       INCREMENT(malloc_count);
    197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                   ^
    198.           return malloc_impl(num, file, line);
    199.   

crypto/mem.c:197:32: Taking true branch
    195.   
    196.       INCREMENT(malloc_count);
    197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                                          ^
    198.           return malloc_impl(num, file, line);
    199.   

crypto/mem.c:198:9: Skipping __function_pointer__(): unresolved function pointer
    196.       INCREMENT(malloc_count);
    197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
    198.           return malloc_impl(num, file, line);
                   ^
    199.   
    200.       if (num == 0)

crypto/mem.c:226:1: return from a call to CRYPTO_malloc
    224.   
    225.       return ret;
    226. > }
    227.   
    228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:233:9: Taking false branch
  231.   
  232.       FAILTEST();
  233.       if (ret != NULL)
                 ^
  234.           memset(ret, 0, num);
  235.       return ret;

crypto/mem.c:235:5: 
  233.       if (ret != NULL)
  234.           memset(ret, 0, num);
  235. >     return ret;
  236.   }
  237.   

crypto/mem.c:236:1: return from a call to CRYPTO_zalloc
  234.           memset(ret, 0, num);
  235.       return ret;
  236. > }
  237.   
  238.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

test/evp_test.c:1695:5: 
1693.       }
1694.       pdat = OPENSSL_zalloc(sizeof(*pdat));
1695. >     pdat->pbe_type = pbe_type;
1696.       t->data = pdat;
1697.       return 1;

static int pbe_test_init(EVP_TEST *t, const char *alg)
{
    PBE_DATA *pdat;
    PBE_TYPE pbe_type = PBE_TYPE_INVALID;
    if (strcmp(alg, "scrypt") == 0) {
#ifndef OPENSSL_NO_SCRYPT
        pbe_type = PBE_TYPE_SCRYPT;
#else
        t->skip = 1;
        return 1;
#endif
    } else if (strcmp(alg, "pbkdf2") == 0) {
        pbe_type = PBE_TYPE_PBKDF2;
    } else if (strcmp(alg, "pkcs12") == 0) {
        pbe_type = PBE_TYPE_PKCS12;
    } else {
        TEST_error("Unknown pbe algorithm %s", alg);
    }
    pdat = OPENSSL_zalloc(sizeof(*pdat));
    pdat->pbe_type = pbe_type;
    t->data = pdat;
    return 1;
}
['static int pbe_test_init(EVP_TEST *t, const char *alg)\n{\n    PBE_DATA *pdat;\n    PBE_TYPE pbe_type = PBE_TYPE_INVALID;\n    if (strcmp(alg, "scrypt") == 0) {\n#ifndef OPENSSL_NO_SCRYPT\n        pbe_type = PBE_TYPE_SCRYPT;\n#else\n        t->skip = 1;\n        return 1;\n#endif\n    } else if (strcmp(alg, "pbkdf2") == 0) {\n        pbe_type = PBE_TYPE_PBKDF2;\n    } else if (strcmp(alg, "pkcs12") == 0) {\n        pbe_type = PBE_TYPE_PKCS12;\n    } else {\n        TEST_error("Unknown pbe algorithm %s", alg);\n    }\n    pdat = OPENSSL_zalloc(sizeof(*pdat));\n    pdat->pbe_type = pbe_type;\n    t->data = pdat;\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    INCREMENT(malloc_count);\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    if (allow_customize) {\n        allow_customize = 0;\n    }\n#if !defined(OPENSSL_NO_CRYPTO_MDEBUG) && !defined(FIPS_MODE)\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}']