apps/apps.c:361: error: NULL_DEREFERENCE
  pointer `arg->data` last assigned on line 358 could be null and is dereferenced at line 361, column 3.
Showing all 24 steps of the trace


apps/apps.c:345:1: start of procedure chopup_args()
343.   #endif
344.   
345. > int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[])
346.   	{
347.   	int num,len,i;

apps/apps.c:350:2: 
348.   	char *p;
349.   
350. > 	*argc=0;
351.   	*argv=NULL;
352.   

apps/apps.c:351:2: 
349.   
350.   	*argc=0;
351. > 	*argv=NULL;
352.   
353.   	len=strlen(buf);

apps/apps.c:353:2: 
351.   	*argv=NULL;
352.   
353. > 	len=strlen(buf);
354.   	i=0;
355.   	if (arg->count == 0)

apps/apps.c:354:2: 
352.   
353.   	len=strlen(buf);
354. > 	i=0;
355.   	if (arg->count == 0)
356.   		{

apps/apps.c:355:6: Taking true branch
353.   	len=strlen(buf);
354.   	i=0;
355.   	if (arg->count == 0)
            ^
356.   		{
357.   		arg->count=20;

apps/apps.c:357:3: 
355.   	if (arg->count == 0)
356.   		{
357. > 		arg->count=20;
358.   		arg->data=(char **)OPENSSL_malloc(sizeof(char *)*arg->count);
359.   		}

apps/apps.c:358:3: 
356.   		{
357.   		arg->count=20;
358. > 		arg->data=(char **)OPENSSL_malloc(sizeof(char *)*arg->count);
359.   		}
360.   	for (i=0; i<arg->count; i++)

crypto/mem.c:291:1: start of procedure CRYPTO_malloc()
  289.   	}
  290.   
  291. > void *CRYPTO_malloc(int num, const char *file, int line)
  292.   	{
  293.   	void *ret = NULL;

crypto/mem.c:293:2: 
  291.   void *CRYPTO_malloc(int num, const char *file, int line)
  292.   	{
  293. > 	void *ret = NULL;
  294.   	extern unsigned char cleanse_ctr;
  295.   

crypto/mem.c:296:6: Taking false branch
  294.   	extern unsigned char cleanse_ctr;
  295.   
  296.   	if (num <= 0) return NULL;
              ^
  297.   
  298.   	allow_customize = 0;

crypto/mem.c:298:2: 
  296.   	if (num <= 0) return NULL;
  297.   
  298. > 	allow_customize = 0;
  299.   	if (malloc_debug_func != NULL)
  300.   		{

crypto/mem.c:299:6: Taking true branch
  297.   
  298.   	allow_customize = 0;
  299.   	if (malloc_debug_func != NULL)
              ^
  300.   		{
  301.   		allow_customize_debug = 0;

crypto/mem.c:301:3: 
  299.   	if (malloc_debug_func != NULL)
  300.   		{
  301. > 		allow_customize_debug = 0;
  302.   		malloc_debug_func(NULL, num, file, line, 0);
  303.   		}

crypto/mem.c:302:3: Skipping __function_pointer__(): unresolved function pointer
  300.   		{
  301.   		allow_customize_debug = 0;
  302.   		malloc_debug_func(NULL, num, file, line, 0);
           ^
  303.   		}
  304.   	ret = malloc_ex_func(num,file,line);

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

crypto/mem.c:308:6: Taking true branch
  306.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
  307.   #endif
  308.   	if (malloc_debug_func != NULL)
              ^
  309.   		malloc_debug_func(ret, num, file, line, 1);
  310.   

crypto/mem.c:309:3: Skipping __function_pointer__(): unresolved function pointer
  307.   #endif
  308.   	if (malloc_debug_func != NULL)
  309.   		malloc_debug_func(ret, num, file, line, 1);
           ^
  310.   
  311.           /* Create a dependency on the value of 'cleanse_ctr' so our memory

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

crypto/mem.c:317:2: 
  315.                   ((unsigned char *)ret)[0] = cleanse_ctr;
  316.   
  317. > 	return ret;
  318.   	}
  319.   

crypto/mem.c:318:2: return from a call to CRYPTO_malloc
  316.   
  317.   	return ret;
  318.   	}
          ^
  319.   
  320.   void *CRYPTO_realloc(void *str, int num, const char *file, int line)

apps/apps.c:360:7: 
358.   		arg->data=(char **)OPENSSL_malloc(sizeof(char *)*arg->count);
359.   		}
360. > 	for (i=0; i<arg->count; i++)
361.   		arg->data[i]=NULL;
362.   

apps/apps.c:360:12: Loop condition is true. Entering loop body
358.   		arg->data=(char **)OPENSSL_malloc(sizeof(char *)*arg->count);
359.   		}
360.   	for (i=0; i<arg->count; i++)
                  ^
361.   		arg->data[i]=NULL;
362.   

apps/apps.c:361:3: 
359.   		}
360.   	for (i=0; i<arg->count; i++)
361. > 		arg->data[i]=NULL;
362.   
363.   	num=0;

int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[])
	{
	int num,len,i;
	char *p;
	*argc=0;
	*argv=NULL;
	len=strlen(buf);
	i=0;
	if (arg->count == 0)
		{
		arg->count=20;
		arg->data=(char **)OPENSSL_malloc(sizeof(char *)*arg->count);
		}
	for (i=0; i<arg->count; i++)
		arg->data[i]=NULL;
	num=0;
	p=buf;
	for (;;)
		{
		if (!*p) break;
		while (*p && ((*p == ' ') || (*p == '\t') || (*p == '\n')))
			p++;
		if (!*p) break;
		if (num >= arg->count)
			{
			arg->count+=20;
			arg->data=(char **)OPENSSL_realloc(arg->data,
				sizeof(char *)*arg->count);
			if (argc == 0) return(0);
			}
		arg->data[num++]=p;
		if ((*p == '\'') || (*p == '\"'))
			{
			i= *(p++);
			arg->data[num-1]++;
			while (*p && (*p != i))
				p++;
			*p='\0';
			}
		else
			{
			while (*p && ((*p != ' ') &&
				(*p != '\t') && (*p != '\n')))
				p++;
			if (*p == '\0')
				p--;
			else
				*p='\0';
			}
		p++;
		}
	*argc=num;
	*argv=arg->data;
	return(1);
	}
['int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[])\n\t{\n\tint num,len,i;\n\tchar *p;\n\t*argc=0;\n\t*argv=NULL;\n\tlen=strlen(buf);\n\ti=0;\n\tif (arg->count == 0)\n\t\t{\n\t\targ->count=20;\n\t\targ->data=(char **)OPENSSL_malloc(sizeof(char *)*arg->count);\n\t\t}\n\tfor (i=0; i<arg->count; i++)\n\t\targ->data[i]=NULL;\n\tnum=0;\n\tp=buf;\n\tfor (;;)\n\t\t{\n\t\tif (!*p) break;\n\t\twhile (*p && ((*p == \' \') || (*p == \'\\t\') || (*p == \'\\n\')))\n\t\t\tp++;\n\t\tif (!*p) break;\n\t\tif (num >= arg->count)\n\t\t\t{\n\t\t\targ->count+=20;\n\t\t\targ->data=(char **)OPENSSL_realloc(arg->data,\n\t\t\t\tsizeof(char *)*arg->count);\n\t\t\tif (argc == 0) return(0);\n\t\t\t}\n\t\targ->data[num++]=p;\n\t\tif ((*p == \'\\\'\') || (*p == \'\\"\'))\n\t\t\t{\n\t\t\ti= *(p++);\n\t\t\targ->data[num-1]++;\n\t\t\twhile (*p && (*p != i))\n\t\t\t\tp++;\n\t\t\t*p=\'\\0\';\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\twhile (*p && ((*p != \' \') &&\n\t\t\t\t(*p != \'\\t\') && (*p != \'\\n\')))\n\t\t\t\tp++;\n\t\t\tif (*p == \'\\0\')\n\t\t\t\tp--;\n\t\t\telse\n\t\t\t\t*p=\'\\0\';\n\t\t\t}\n\t\tp++;\n\t\t}\n\t*argc=num;\n\t*argv=arg->data;\n\treturn(1);\n\t}', 'void *CRYPTO_malloc(int num, const char *file, int line)\n\t{\n\tvoid *ret = NULL;\n\textern unsigned char cleanse_ctr;\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        if(ret && (num > 2048))\n                ((unsigned char *)ret)[0] = cleanse_ctr;\n\treturn ret;\n\t}']