crypto/mem.c:367: error: NULL_DEREFERENCE
  pointer `ret` last assigned on line 365 could be null and is dereferenced by call to `strcpy()` at line 367, column 5.
Showing all 8 steps of the trace


crypto/mem.c:363:1: start of procedure CRYPTO_strdup()
361.   }
362.   
363. > char *CRYPTO_strdup(const char *str, const char *file, int line)
364.   {
365.       char *ret = CRYPTO_malloc(strlen(str) + 1, file, line);

crypto/mem.c:365:5: 
363.   char *CRYPTO_strdup(const char *str, const char *file, int line)
364.   {
365. >     char *ret = CRYPTO_malloc(strlen(str) + 1, file, line);
366.   
367.       strcpy(ret, str);

crypto/mem.c:327:1: start of procedure CRYPTO_malloc()
  325.   }
  326.   
  327. > void *CRYPTO_malloc(int num, const char *file, int line)
  328.   {
  329.       void *ret = NULL;

crypto/mem.c:329:5: 
  327.   void *CRYPTO_malloc(int num, const char *file, int line)
  328.   {
  329. >     void *ret = NULL;
  330.   
  331.       if (num <= 0)

crypto/mem.c:331:9: Taking true branch
  329.       void *ret = NULL;
  330.   
  331.       if (num <= 0)
                 ^
  332.           return NULL;
  333.   

crypto/mem.c:332:9: 
  330.   
  331.       if (num <= 0)
  332. >         return NULL;
  333.   
  334.       if (allow_customize)

crypto/mem.c:361:1: return from a call to CRYPTO_malloc
  359.   
  360.       return ret;
  361. > }
  362.   
  363.   char *CRYPTO_strdup(const char *str, const char *file, int line)

crypto/mem.c:367:5: 
365.       char *ret = CRYPTO_malloc(strlen(str) + 1, file, line);
366.   
367. >     strcpy(ret, str);
368.       return ret;
369.   }

char *CRYPTO_strdup(const char *str, const char *file, int line)
{
    char *ret = CRYPTO_malloc(strlen(str) + 1, file, line);
    strcpy(ret, str);
    return ret;
}
['char *CRYPTO_strdup(const char *str, const char *file, int line)\n{\n    char *ret = CRYPTO_malloc(strlen(str) + 1, file, line);\n    strcpy(ret, str);\n    return ret;\n}', 'void *CRYPTO_malloc(int num, const char *file, int line)\n{\n    void *ret = NULL;\n    if (num <= 0)\n        return NULL;\n    if (allow_customize)\n        allow_customize = 0;\n    if (malloc_debug_func != NULL) {\n        if (allow_customize_debug)\n            allow_customize_debug = 0;\n        malloc_debug_func(NULL, num, file, line, 0);\n    }\n    ret = malloc_ex_func(num, file, line);\n#ifdef LEVITTE_DEBUG_MEM\n    fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\\n", ret, num);\n#endif\n    if (malloc_debug_func != NULL)\n        malloc_debug_func(ret, num, file, line, 1);\n#ifndef OPENSSL_CPUID_OBJ\n    if (ret && (num > 2048)) {\n        extern unsigned char cleanse_ctr;\n        ((unsigned char *)ret)[0] = cleanse_ctr;\n    }\n#endif\n    return ret;\n}']