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


test/evp_test.c:1366:1: start of procedure pbe_test_init()
1364.   }
1365.   
1366. > static int pbe_test_init(EVP_TEST *t, const char *alg)
1367.   {
1368.       PBE_DATA *pdat;

test/evp_test.c:1369:5: 
1367.   {
1368.       PBE_DATA *pdat;
1369. >     PBE_TYPE pbe_type = PBE_TYPE_INVALID;
1370.   
1371.       if (strcmp(alg, "scrypt") == 0) {

test/evp_test.c:1371:9: Taking false branch
1369.       PBE_TYPE pbe_type = PBE_TYPE_INVALID;
1370.   
1371.       if (strcmp(alg, "scrypt") == 0) {
                ^
1372.   #ifndef OPENSSL_NO_SCRYPT
1373.           pbe_type = PBE_TYPE_SCRYPT;

test/evp_test.c:1378:16: Taking false branch
1376.           return 1;
1377.   #endif
1378.       } else if (strcmp(alg, "pbkdf2") == 0) {
                       ^
1379.           pbe_type = PBE_TYPE_PBKDF2;
1380.       } else if (strcmp(alg, "pkcs12") == 0) {

test/evp_test.c:1380:16: Taking false branch
1378.       } else if (strcmp(alg, "pbkdf2") == 0) {
1379.           pbe_type = PBE_TYPE_PBKDF2;
1380.       } else if (strcmp(alg, "pkcs12") == 0) {
                       ^
1381.           pbe_type = PBE_TYPE_PKCS12;
1382.       } else {

test/evp_test.c:1383:9: Skipping test_error(): empty list of specs
1381.           pbe_type = PBE_TYPE_PKCS12;
1382.       } else {
1383.           TEST_error("Unknown pbe algorithm %s", alg);
                ^
1384.       }
1385.       pdat = OPENSSL_zalloc(sizeof(*pdat));

test/evp_test.c:1385:5: 
1383.           TEST_error("Unknown pbe algorithm %s", alg);
1384.       }
1385. >     pdat = OPENSSL_zalloc(sizeof(*pdat));
1386.       pdat->pbe_type = pbe_type;
1387.       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:1386:5: 
1384.       }
1385.       pdat = OPENSSL_zalloc(sizeof(*pdat));
1386. >     pdat->pbe_type = pbe_type;
1387.       t->data = pdat;
1388.       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}']