test/evp_test.c:1105: error: NULL_DEREFERENCE
  pointer `mdat` last assigned on line 1104 could be null and is dereferenced at line 1105, column 5.
Showing all 15 steps of the trace


test/evp_test.c:1088:1: start of procedure mac_test_init()
1086.   };
1087.   
1088. > static int mac_test_init(struct evp_test *t, const char *alg)
1089.   {
1090.       int type;

test/evp_test.c:1092:9: Taking true branch
1090.       int type;
1091.       struct mac_data *mdat;
1092.       if (strcmp(alg, "HMAC") == 0) {
                ^
1093.           type = EVP_PKEY_HMAC;
1094.       } else if (strcmp(alg, "CMAC") == 0) {

test/evp_test.c:1093:9: 
1091.       struct mac_data *mdat;
1092.       if (strcmp(alg, "HMAC") == 0) {
1093. >         type = EVP_PKEY_HMAC;
1094.       } else if (strcmp(alg, "CMAC") == 0) {
1095.   #ifndef OPENSSL_NO_CMAC

test/evp_test.c:1104:5: 
1102.           return 0;
1103.   
1104. >     mdat = OPENSSL_malloc(sizeof(*mdat));
1105.       mdat->type = type;
1106.       mdat->alg = 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:1105:5: 
1103.   
1104.       mdat = OPENSSL_malloc(sizeof(*mdat));
1105. >     mdat->type = type;
1106.       mdat->alg = NULL;
1107.       mdat->key = NULL;

static int mac_test_init(struct evp_test *t, const char *alg)
{
    int type;
    struct mac_data *mdat;
    if (strcmp(alg, "HMAC") == 0) {
        type = EVP_PKEY_HMAC;
    } else if (strcmp(alg, "CMAC") == 0) {
#ifndef OPENSSL_NO_CMAC
        type = EVP_PKEY_CMAC;
#else
        t->skip = 1;
        return 1;
#endif
    } else
        return 0;
    mdat = OPENSSL_malloc(sizeof(*mdat));
    mdat->type = type;
    mdat->alg = NULL;
    mdat->key = NULL;
    mdat->input = NULL;
    mdat->output = NULL;
    t->data = mdat;
    return 1;
}
['static int mac_test_init(struct evp_test *t, const char *alg)\n{\n    int type;\n    struct mac_data *mdat;\n    if (strcmp(alg, "HMAC") == 0) {\n        type = EVP_PKEY_HMAC;\n    } else if (strcmp(alg, "CMAC") == 0) {\n#ifndef OPENSSL_NO_CMAC\n        type = EVP_PKEY_CMAC;\n#else\n        t->skip = 1;\n        return 1;\n#endif\n    } else\n        return 0;\n    mdat = OPENSSL_malloc(sizeof(*mdat));\n    mdat->type = type;\n    mdat->alg = NULL;\n    mdat->key = NULL;\n    mdat->input = NULL;\n    mdat->output = NULL;\n    t->data = mdat;\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}']