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


test/evp_test.c:1352:1: start of procedure pbe_test_init()
1350.   }
1351.   
1352. > static int pbe_test_init(EVP_TEST *t, const char *alg)
1353.   {
1354.       PBE_DATA *pdat;

test/evp_test.c:1355:5: 
1353.   {
1354.       PBE_DATA *pdat;
1355. >     PBE_TYPE pbe_type = PBE_TYPE_INVALID;
1356.   
1357.       if (strcmp(alg, "scrypt") == 0) {

test/evp_test.c:1357:9: Taking false branch
1355.       PBE_TYPE pbe_type = PBE_TYPE_INVALID;
1356.   
1357.       if (strcmp(alg, "scrypt") == 0) {
                ^
1358.   #ifndef OPENSSL_NO_SCRYPT
1359.           pbe_type = PBE_TYPE_SCRYPT;

test/evp_test.c:1364:16: Taking false branch
1362.           return 1;
1363.   #endif
1364.       } else if (strcmp(alg, "pbkdf2") == 0) {
                       ^
1365.           pbe_type = PBE_TYPE_PBKDF2;
1366.       } else if (strcmp(alg, "pkcs12") == 0) {

test/evp_test.c:1366:16: Taking false branch
1364.       } else if (strcmp(alg, "pbkdf2") == 0) {
1365.           pbe_type = PBE_TYPE_PBKDF2;
1366.       } else if (strcmp(alg, "pkcs12") == 0) {
                       ^
1367.           pbe_type = PBE_TYPE_PKCS12;
1368.       } else {

test/evp_test.c:1369:9: Skipping test_error(): empty list of specs
1367.           pbe_type = PBE_TYPE_PKCS12;
1368.       } else {
1369.           TEST_error("Unknown pbe algorithm %s", alg);
                ^
1370.       }
1371.       pdat = OPENSSL_zalloc(sizeof(*pdat));

test/evp_test.c:1371:5: 
1369.           TEST_error("Unknown pbe algorithm %s", alg);
1370.       }
1371. >     pdat = OPENSSL_zalloc(sizeof(*pdat));
1372.       pdat->pbe_type = pbe_type;
1373.       t->data = pdat;

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 true 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:173:32: Taking true 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:174:9: Skipping __function_pointer__(): unresolved function pointer
    172.   
    173.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
    174.           return malloc_impl(num, file, line);
                   ^
    175.   
    176.       if (num == 0)

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 false branch
  200.   
  201.       FAILTEST();
  202.       if (ret != NULL)
                 ^
  203.           memset(ret, 0, num);
  204.       return ret;

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/evp_test.c:1372:5: 
1370.       }
1371.       pdat = OPENSSL_zalloc(sizeof(*pdat));
1372. >     pdat->pbe_type = pbe_type;
1373.       t->data = pdat;
1374.       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    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}']