test/evp_test.c:1676: error: NULL_DEREFERENCE
  pointer `edata` last assigned on line 1671 could be null and is dereferenced at line 1676, column 9.
Showing all 16 steps of the trace


test/evp_test.c:1669:1: start of procedure encode_test_init()
1667.   };
1668.   
1669. > static int encode_test_init(struct evp_test *t, const char *encoding)
1670.   {
1671.       struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata));

test/evp_test.c:1671:5: 
1669.   static int encode_test_init(struct evp_test *t, const char *encoding)
1670.   {
1671. >     struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata));
1672.   
1673.       if (strcmp(encoding, "canonical") == 0) {

crypto/mem.c:98:1: start of procedure CRYPTO_zalloc()
  96.   }
  97.   
  98. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
  99.   {
  100.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:100:5: 
  98.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
  99.   {
  100. >     void *ret = CRYPTO_malloc(num, file, line);
  101.   
  102.       if (ret != 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 true 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:75:32: Taking true 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:76:9: Skipping __function_pointer__(): unresolved function pointer
    74.   
    75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
    76.           return malloc_impl(num, file, line);
                  ^
    77.   
    78.       if (num <= 0)

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)

crypto/mem.c:102:9: Taking false branch
  100.       void *ret = CRYPTO_malloc(num, file, line);
  101.   
  102.       if (ret != NULL)
                 ^
  103.           memset(ret, 0, num);
  104.       return ret;

crypto/mem.c:104:5: 
  102.       if (ret != NULL)
  103.           memset(ret, 0, num);
  104. >     return ret;
  105.   }
  106.   

crypto/mem.c:105:1: return from a call to CRYPTO_zalloc
  103.           memset(ret, 0, num);
  104.       return ret;
  105. > }
  106.   
  107.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

test/evp_test.c:1673:9: Taking false branch
1671.       struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata));
1672.   
1673.       if (strcmp(encoding, "canonical") == 0) {
                ^
1674.           edata->encoding = BASE64_CANONICAL_ENCODING;
1675.       } else if (strcmp(encoding, "valid") == 0) {

test/evp_test.c:1675:16: Taking true branch
1673.       if (strcmp(encoding, "canonical") == 0) {
1674.           edata->encoding = BASE64_CANONICAL_ENCODING;
1675.       } else if (strcmp(encoding, "valid") == 0) {
                       ^
1676.           edata->encoding = BASE64_VALID_ENCODING;
1677.       } else if (strcmp(encoding, "invalid") == 0) {

test/evp_test.c:1676:9: 
1674.           edata->encoding = BASE64_CANONICAL_ENCODING;
1675.       } else if (strcmp(encoding, "valid") == 0) {
1676. >         edata->encoding = BASE64_VALID_ENCODING;
1677.       } else if (strcmp(encoding, "invalid") == 0) {
1678.           edata->encoding = BASE64_INVALID_ENCODING;

static int encode_test_init(struct evp_test *t, const char *encoding)
{
    struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata));
    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;
        t->expected_err = OPENSSL_strdup("DECODE_ERROR");
        if (t->expected_err == NULL)
            return 0;
    } else {
        fprintf(stderr, "Bad encoding: %s. Should be one of "
                "{canonical, valid, invalid}\n", encoding);
        return 0;
    }
    t->data = edata;
    return 1;
}
['static int encode_test_init(struct evp_test *t, const char *encoding)\n{\n    struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata));\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        t->expected_err = OPENSSL_strdup("DECODE_ERROR");\n        if (t->expected_err == NULL)\n            return 0;\n    } else {\n        fprintf(stderr, "Bad encoding: %s. Should be one of "\n                "{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    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    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}']