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


crypto/mem.c:328:1: start of procedure CRYPTO_strdup()
326.   	return ret;
327.   	}
328. > char *CRYPTO_strdup(const char *str, const char *file, int line)
329.   	{
330.   	char *ret = CRYPTO_malloc(strlen(str)+1, file, line);

crypto/mem.c:330:2: 
328.   char *CRYPTO_strdup(const char *str, const char *file, int line)
329.   	{
330. > 	char *ret = CRYPTO_malloc(strlen(str)+1, file, line);
331.   
332.   	strcpy(ret, str);

crypto/mem.c:297:1: start of procedure CRYPTO_malloc()
  295.   	}
  296.   
  297. > void *CRYPTO_malloc(int num, const char *file, int line)
  298.   	{
  299.   	void *ret = NULL;

crypto/mem.c:299:2: 
  297.   void *CRYPTO_malloc(int num, const char *file, int line)
  298.   	{
  299. > 	void *ret = NULL;
  300.   
  301.   	if (num <= 0) return NULL;

crypto/mem.c:301:6: Taking false branch
  299.   	void *ret = NULL;
  300.   
  301.   	if (num <= 0) return NULL;
              ^
  302.   
  303.   	allow_customize = 0;

crypto/mem.c:303:2: 
  301.   	if (num <= 0) return NULL;
  302.   
  303. > 	allow_customize = 0;
  304.   	if (malloc_debug_func != NULL)
  305.   		{

crypto/mem.c:304:6: Taking true branch
  302.   
  303.   	allow_customize = 0;
  304.   	if (malloc_debug_func != NULL)
              ^
  305.   		{
  306.   		allow_customize_debug = 0;

crypto/mem.c:306:3: 
  304.   	if (malloc_debug_func != NULL)
  305.   		{
  306. > 		allow_customize_debug = 0;
  307.   		malloc_debug_func(NULL, num, file, line, 0);
  308.   		}

crypto/mem.c:307:3: Skipping __function_pointer__(): unresolved function pointer
  305.   		{
  306.   		allow_customize_debug = 0;
  307.   		malloc_debug_func(NULL, num, file, line, 0);
           ^
  308.   		}
  309.   	ret = malloc_ex_func(num,file,line);

crypto/mem.c:309:2: Skipping __function_pointer__(): unresolved function pointer
  307.   		malloc_debug_func(NULL, num, file, line, 0);
  308.   		}
  309.   	ret = malloc_ex_func(num,file,line);
          ^
  310.   #ifdef LEVITTE_DEBUG_MEM
  311.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);

crypto/mem.c:313:6: Taking true branch
  311.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
  312.   #endif
  313.   	if (malloc_debug_func != NULL)
              ^
  314.   		malloc_debug_func(ret, num, file, line, 1);
  315.   

crypto/mem.c:314:3: Skipping __function_pointer__(): unresolved function pointer
  312.   #endif
  313.   	if (malloc_debug_func != NULL)
  314.   		malloc_debug_func(ret, num, file, line, 1);
           ^
  315.   
  316.   #ifndef OPENSSL_CPUID_OBJ

crypto/mem.c:320:12: Taking false branch
  318.            * sanitisation function can't be optimised out. NB: We only do
  319.            * this for >2Kb so the overhead doesn't bother us. */
  320.           if(ret && (num > 2048))
                    ^
  321.   	{	extern unsigned char cleanse_ctr;
  322.                   ((unsigned char *)ret)[0] = cleanse_ctr;

crypto/mem.c:326:2: 
  324.   #endif
  325.   
  326. > 	return ret;
  327.   	}
  328.   char *CRYPTO_strdup(const char *str, const char *file, int line)

crypto/mem.c:327:2: return from a call to CRYPTO_malloc
  325.   
  326.   	return ret;
  327.   	}
          ^
  328.   char *CRYPTO_strdup(const char *str, const char *file, int line)
  329.   	{

crypto/mem.c:332:2: 
330.   	char *ret = CRYPTO_malloc(strlen(str)+1, file, line);
331.   
332. > 	strcpy(ret, str);
333.   	return ret;
334.   	}

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\t{\n\tchar *ret = CRYPTO_malloc(strlen(str)+1, file, line);\n\tstrcpy(ret, str);\n\treturn ret;\n\t}', 'void *CRYPTO_malloc(int num, const char *file, int line)\n\t{\n\tvoid *ret = NULL;\n\tif (num <= 0) return NULL;\n\tallow_customize = 0;\n\tif (malloc_debug_func != NULL)\n\t\t{\n\t\tallow_customize_debug = 0;\n\t\tmalloc_debug_func(NULL, num, file, line, 0);\n\t\t}\n\tret = malloc_ex_func(num,file,line);\n#ifdef LEVITTE_DEBUG_MEM\n\tfprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\\n", ret, num);\n#endif\n\tif (malloc_debug_func != NULL)\n\t\tmalloc_debug_func(ret, num, file, line, 1);\n#ifndef OPENSSL_CPUID_OBJ\n        if(ret && (num > 2048))\n\t{\textern unsigned char cleanse_ctr;\n                ((unsigned char *)ret)[0] = cleanse_ctr;\n\t}\n#endif\n\treturn ret;\n\t}']