crypto/objects/o_names.c:106: error: NULL_DEREFERENCE
  pointer `name_funcs` last assigned on line 104 could be null and is dereferenced at line 106, column 3.
Showing all 19 steps of the trace


crypto/objects/o_names.c:62:1: start of procedure OBJ_NAME_new_index()
60.   	}
61.   
62. > int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *),
63.   	int (*cmp_func)(const char *, const char *),
64.   	void (*free_func)(const char *, int, const char *))

crypto/objects/o_names.c:70:6: Taking false branch
68.   	NAME_FUNCS *name_funcs;
69.   
70.   	if (name_funcs_stack == NULL)
           ^
71.   		{
72.   		MemCheck_off();

crypto/objects/o_names.c:76:7: Taking false branch
74.   		MemCheck_on();
75.   		}
76.   	if ((name_funcs_stack == NULL))
            ^
77.   		{
78.   		/* ERROR */

crypto/objects/o_names.c:81:2: 
79.   		return(0);
80.   		}
81. > 	ret=names_type_num;
82.   	names_type_num++;
83.   	for (i=sk_NAME_FUNCS_num(name_funcs_stack); i<names_type_num; i++)

crypto/objects/o_names.c:82:2: 
80.   		}
81.   	ret=names_type_num;
82. > 	names_type_num++;
83.   	for (i=sk_NAME_FUNCS_num(name_funcs_stack); i<names_type_num; i++)
84.   		{

crypto/objects/o_names.c:83:7: 
81.   	ret=names_type_num;
82.   	names_type_num++;
83. > 	for (i=sk_NAME_FUNCS_num(name_funcs_stack); i<names_type_num; i++)
84.   		{
85.   		MemCheck_off();

crypto/stack/stack.c:301:1: start of procedure sk_num()
  299.   	}
  300.   
  301. > int sk_num(const STACK *st)
  302.   {
  303.   	if(st == NULL) return -1;

crypto/stack/stack.c:303:5: Taking false branch
  301.   int sk_num(const STACK *st)
  302.   {
  303.   	if(st == NULL) return -1;
             ^
  304.   	return st->num;
  305.   }

crypto/stack/stack.c:304:2: 
  302.   {
  303.   	if(st == NULL) return -1;
  304. > 	return st->num;
  305.   }
  306.   

crypto/stack/stack.c:305:1: return from a call to sk_num
  303.   	if(st == NULL) return -1;
  304.   	return st->num;
  305. > }
  306.   
  307.   char *sk_value(const STACK *st, int i)

crypto/objects/o_names.c:83:46: Loop condition is false. Leaving loop
81.   	ret=names_type_num;
82.   	names_type_num++;
83.   	for (i=sk_NAME_FUNCS_num(name_funcs_stack); i<names_type_num; i++)
                                                   ^
84.   		{
85.   		MemCheck_off();

crypto/objects/o_names.c:104:2: 
102.   		MemCheck_on();
103.   		}
104. > 	name_funcs = sk_NAME_FUNCS_value(name_funcs_stack, ret);
105.   	if (hash_func != NULL)
106.   		name_funcs->hash_func = hash_func;

crypto/stack/stack.c:307:1: start of procedure sk_value()
  305.   }
  306.   
  307. > char *sk_value(const STACK *st, int i)
  308.   {
  309.   	if(!st || (i < 0) || (i >= st->num)) return NULL;

crypto/stack/stack.c:309:6: Taking false branch
  307.   char *sk_value(const STACK *st, int i)
  308.   {
  309.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
              ^
  310.   	return st->data[i];
  311.   }

crypto/stack/stack.c:309:13: Taking true branch
  307.   char *sk_value(const STACK *st, int i)
  308.   {
  309.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                     ^
  310.   	return st->data[i];
  311.   }

crypto/stack/stack.c:309:39: 
  307.   char *sk_value(const STACK *st, int i)
  308.   {
  309. > 	if(!st || (i < 0) || (i >= st->num)) return NULL;
  310.   	return st->data[i];
  311.   }

crypto/stack/stack.c:311:1: return from a call to sk_value
  309.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
  310.   	return st->data[i];
  311. > }
  312.   
  313.   char *sk_set(STACK *st, int i, char *value)

crypto/objects/o_names.c:105:6: Taking true branch
103.   		}
104.   	name_funcs = sk_NAME_FUNCS_value(name_funcs_stack, ret);
105.   	if (hash_func != NULL)
            ^
106.   		name_funcs->hash_func = hash_func;
107.   	if (cmp_func != NULL)

crypto/objects/o_names.c:106:3: 
104.   	name_funcs = sk_NAME_FUNCS_value(name_funcs_stack, ret);
105.   	if (hash_func != NULL)
106. > 		name_funcs->hash_func = hash_func;
107.   	if (cmp_func != NULL)
108.   		name_funcs->cmp_func = cmp_func;

int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *),
	int (*cmp_func)(const char *, const char *),
	void (*free_func)(const char *, int, const char *))
	{
	int ret;
	int i;
	NAME_FUNCS *name_funcs;
	if (name_funcs_stack == NULL)
		{
		MemCheck_off();
		name_funcs_stack=sk_NAME_FUNCS_new_null();
		MemCheck_on();
		}
	if ((name_funcs_stack == NULL))
		{
		return(0);
		}
	ret=names_type_num;
	names_type_num++;
	for (i=sk_NAME_FUNCS_num(name_funcs_stack); i<names_type_num; i++)
		{
		MemCheck_off();
		name_funcs = OPENSSL_malloc(sizeof(NAME_FUNCS));
		MemCheck_on();
		if (!name_funcs)
			{
			OBJerr(OBJ_F_OBJ_NAME_NEW_INDEX,ERR_R_MALLOC_FAILURE);
			return(0);
			}
		name_funcs->hash_func = lh_strhash;
		name_funcs->cmp_func = OPENSSL_strcmp;
		name_funcs->free_func = 0;
		MemCheck_off();
		sk_NAME_FUNCS_push(name_funcs_stack,name_funcs);
		MemCheck_on();
		}
	name_funcs = sk_NAME_FUNCS_value(name_funcs_stack, ret);
	if (hash_func != NULL)
		name_funcs->hash_func = hash_func;
	if (cmp_func != NULL)
		name_funcs->cmp_func = cmp_func;
	if (free_func != NULL)
		name_funcs->free_func = free_func;
	return(ret);
	}
['int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *),\n\tint (*cmp_func)(const char *, const char *),\n\tvoid (*free_func)(const char *, int, const char *))\n\t{\n\tint ret;\n\tint i;\n\tNAME_FUNCS *name_funcs;\n\tif (name_funcs_stack == NULL)\n\t\t{\n\t\tMemCheck_off();\n\t\tname_funcs_stack=sk_NAME_FUNCS_new_null();\n\t\tMemCheck_on();\n\t\t}\n\tif ((name_funcs_stack == NULL))\n\t\t{\n\t\treturn(0);\n\t\t}\n\tret=names_type_num;\n\tnames_type_num++;\n\tfor (i=sk_NAME_FUNCS_num(name_funcs_stack); i<names_type_num; i++)\n\t\t{\n\t\tMemCheck_off();\n\t\tname_funcs = OPENSSL_malloc(sizeof(NAME_FUNCS));\n\t\tMemCheck_on();\n\t\tif (!name_funcs)\n\t\t\t{\n\t\t\tOBJerr(OBJ_F_OBJ_NAME_NEW_INDEX,ERR_R_MALLOC_FAILURE);\n\t\t\treturn(0);\n\t\t\t}\n\t\tname_funcs->hash_func = lh_strhash;\n\t\tname_funcs->cmp_func = OPENSSL_strcmp;\n\t\tname_funcs->free_func = 0;\n\t\tMemCheck_off();\n\t\tsk_NAME_FUNCS_push(name_funcs_stack,name_funcs);\n\t\tMemCheck_on();\n\t\t}\n\tname_funcs = sk_NAME_FUNCS_value(name_funcs_stack, ret);\n\tif (hash_func != NULL)\n\t\tname_funcs->hash_func = hash_func;\n\tif (cmp_func != NULL)\n\t\tname_funcs->cmp_func = cmp_func;\n\tif (free_func != NULL)\n\t\tname_funcs->free_func = free_func;\n\treturn(ret);\n\t}', 'int sk_num(const STACK *st)\n{\n\tif(st == NULL) return -1;\n\treturn st->num;\n}', 'char *sk_value(const STACK *st, int i)\n{\n\tif(!st || (i < 0) || (i >= st->num)) return NULL;\n\treturn st->data[i];\n}']