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


test/evp_test.c:1596:1: start of procedure pbe_test_init()
1594.   }
1595.   
1596. > static int pbe_test_init(struct evp_test *t, const char *alg)
1597.   {
1598.       struct pbe_data *pdat;

test/evp_test.c:1599:5: 
1597.   {
1598.       struct pbe_data *pdat;
1599. >     int pbe_type = 0;
1600.   
1601.       if (strcmp(alg, "scrypt") == 0) {

test/evp_test.c:1601:9: Taking false branch
1599.       int pbe_type = 0;
1600.   
1601.       if (strcmp(alg, "scrypt") == 0) {
                ^
1602.   #ifndef OPENSSL_NO_SCRYPT
1603.           pbe_type = PBE_TYPE_SCRYPT;

test/evp_test.c:1608:16: Taking false branch
1606.           return 1;
1607.   #endif
1608.       } else if (strcmp(alg, "pbkdf2") == 0) {
                       ^
1609.           pbe_type = PBE_TYPE_PBKDF2;
1610.       } else if (strcmp(alg, "pkcs12") == 0) {

test/evp_test.c:1610:16: Taking false branch
1608.       } else if (strcmp(alg, "pbkdf2") == 0) {
1609.           pbe_type = PBE_TYPE_PBKDF2;
1610.       } else if (strcmp(alg, "pkcs12") == 0) {
                       ^
1611.           pbe_type = PBE_TYPE_PKCS12;
1612.       } else {

test/evp_test.c:1613:9: 
1611.           pbe_type = PBE_TYPE_PKCS12;
1612.       } else {
1613. >         fprintf(stderr, "Unknown pbe algorithm %s\n", alg);
1614.       }
1615.       pdat = OPENSSL_malloc(sizeof(*pdat));

test/evp_test.c:1615:5: 
1613.           fprintf(stderr, "Unknown pbe algorithm %s\n", alg);
1614.       }
1615. >     pdat = OPENSSL_malloc(sizeof(*pdat));
1616.       pdat->pbe_type = pbe_type;
1617.       pdat->pass = NULL;

crypto/mem.c:71:1: start of procedure CRYPTO_malloc()
  69.   }
  70.   
  71. > void *CRYPTO_malloc(size_t num, const char *file, int line)
  72.   {
  73.       void *ret = NULL;

crypto/mem.c:73:5: 
  71.   void *CRYPTO_malloc(size_t num, const char *file, int line)
  72.   {
  73. >     void *ret = NULL;
  74.   
  75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:75:9: Taking false branch
  73.       void *ret = NULL;
  74.   
  75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                ^
  76.           return malloc_impl(num, file, line);
  77.   

crypto/mem.c:78:9: Taking false branch
  76.           return malloc_impl(num, file, line);
  77.   
  78.       if (num <= 0)
                ^
  79.           return NULL;
  80.   

crypto/mem.c:81:5: 
  79.           return NULL;
  80.   
  81. >     allow_customize = 0;
  82.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
  83.       if (call_malloc_debug) {

crypto/mem.c:91:5: 
  89.       }
  90.   #else
  91. >     osslargused(file); osslargused(line);
  92.       ret = malloc(num);
  93.   #endif

crypto/mem.c:91:24: 
  89.       }
  90.   #else
  91. >     osslargused(file); osslargused(line);
  92.       ret = malloc(num);
  93.   #endif

crypto/mem.c:92:5: 
  90.   #else
  91.       osslargused(file); osslargused(line);
  92. >     ret = malloc(num);
  93.   #endif
  94.   

crypto/mem.c:95:5: 
  93.   #endif
  94.   
  95. >     return ret;
  96.   }
  97.   

crypto/mem.c:96:1: return from a call to CRYPTO_malloc
  94.   
  95.       return ret;
  96. > }
  97.   
  98.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

test/evp_test.c:1616:5: 
1614.       }
1615.       pdat = OPENSSL_malloc(sizeof(*pdat));
1616. >     pdat->pbe_type = pbe_type;
1617.       pdat->pass = NULL;
1618.       pdat->salt = NULL;

static int pbe_test_init(struct evp_test *t, const char *alg)
{
    struct pbe_data *pdat;
    int pbe_type = 0;
    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 {
        fprintf(stderr, "Unknown pbe algorithm %s\n", alg);
    }
    pdat = OPENSSL_malloc(sizeof(*pdat));
    pdat->pbe_type = pbe_type;
    pdat->pass = NULL;
    pdat->salt = NULL;
    pdat->N = 0;
    pdat->r = 0;
    pdat->p = 0;
    pdat->maxmem = 0;
    pdat->id = 0;
    pdat->iter = 0;
    pdat->md = NULL;
    t->data = pdat;
    return 1;
}
['static int pbe_test_init(struct evp_test *t, const char *alg)\n{\n    struct pbe_data *pdat;\n    int pbe_type = 0;\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        fprintf(stderr, "Unknown pbe algorithm %s\\n", alg);\n    }\n    pdat = OPENSSL_malloc(sizeof(*pdat));\n    pdat->pbe_type = pbe_type;\n    pdat->pass = NULL;\n    pdat->salt = NULL;\n    pdat->N = 0;\n    pdat->r = 0;\n    pdat->p = 0;\n    pdat->maxmem = 0;\n    pdat->id = 0;\n    pdat->iter = 0;\n    pdat->md = NULL;\n    t->data = pdat;\n    return 1;\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    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}']