crypto/asn1/x_name.c:228: error: NULL_DEREFERENCE
  pointer `entries` last assigned on line 215 could be null and is dereferenced by call to `sk_push()` at line 228, column 7.
Showing all 25 steps of the trace


crypto/asn1/x_name.c:210:1: start of procedure x509_name_encode()
208.   }
209.   
210. > static int x509_name_encode(X509_NAME *a)
211.   {
212.   	STACK *intname = NULL;

crypto/asn1/x_name.c:212:2: 
210.   static int x509_name_encode(X509_NAME *a)
211.   {
212. > 	STACK *intname = NULL;
213.   	int len;
214.   	unsigned char *p;

crypto/asn1/x_name.c:215:2: 
213.   	int len;
214.   	unsigned char *p;
215. > 	STACK_OF(X509_NAME_ENTRY) *entries = NULL;
216.   	X509_NAME_ENTRY *entry;
217.   	int i, set = -1;

crypto/asn1/x_name.c:217:2: 
215.   	STACK_OF(X509_NAME_ENTRY) *entries = NULL;
216.   	X509_NAME_ENTRY *entry;
217. > 	int i, set = -1;
218.   	intname = sk_new_null();
219.   	if(!intname) goto memerr;

crypto/asn1/x_name.c:218:2: 
216.   	X509_NAME_ENTRY *entry;
217.   	int i, set = -1;
218. > 	intname = sk_new_null();
219.   	if(!intname) goto memerr;
220.   	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {

crypto/stack/stack.c:112:1: start of procedure sk_new_null()
  110.   	}
  111.   
  112. > STACK *sk_new_null(void)
  113.   	{
  114.   	return sk_new((int (*)(const char * const *, const char * const *))0);

crypto/stack/stack.c:114:2: Skipping sk_new(): empty list of specs
  112.   STACK *sk_new_null(void)
  113.   	{
  114.   	return sk_new((int (*)(const char * const *, const char * const *))0);
          ^
  115.   	}
  116.   

crypto/stack/stack.c:115:2: return from a call to sk_new_null
  113.   	{
  114.   	return sk_new((int (*)(const char * const *, const char * const *))0);
  115.   	}
          ^
  116.   
  117.   STACK *sk_new(int (*c)(const char * const *, const char * const *))

crypto/asn1/x_name.c:219:6: Taking false branch
217.   	int i, set = -1;
218.   	intname = sk_new_null();
219.   	if(!intname) goto memerr;
            ^
220.   	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
221.   		entry = sk_X509_NAME_ENTRY_value(a->entries, i);

crypto/asn1/x_name.c:220:6: 
218.   	intname = sk_new_null();
219.   	if(!intname) goto memerr;
220. > 	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
221.   		entry = sk_X509_NAME_ENTRY_value(a->entries, i);
222.   		if(entry->set != set) {

crypto/asn1/x_name.c:220:13: 
218.   	intname = sk_new_null();
219.   	if(!intname) goto memerr;
220. > 	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
221.   		entry = sk_X509_NAME_ENTRY_value(a->entries, i);
222.   		if(entry->set != set) {

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

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

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

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

crypto/asn1/x_name.c:220:13: Loop condition is true. Entering loop body
218.   	intname = sk_new_null();
219.   	if(!intname) goto memerr;
220.   	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
                   ^
221.   		entry = sk_X509_NAME_ENTRY_value(a->entries, i);
222.   		if(entry->set != set) {

crypto/asn1/x_name.c:221:3: 
219.   	if(!intname) goto memerr;
220.   	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
221. > 		entry = sk_X509_NAME_ENTRY_value(a->entries, i);
222.   		if(entry->set != set) {
223.   			entries = sk_X509_NAME_ENTRY_new_null();

crypto/stack/stack.c:305:1: start of procedure sk_value()
  303.   }
  304.   
  305. > char *sk_value(const STACK *st, int i)
  306.   {
  307.   	if(st == NULL) return NULL;

crypto/stack/stack.c:307:5: Taking false branch
  305.   char *sk_value(const STACK *st, int i)
  306.   {
  307.   	if(st == NULL) return NULL;
             ^
  308.   	return st->data[i];
  309.   }

crypto/stack/stack.c:308:2: 
  306.   {
  307.   	if(st == NULL) return NULL;
  308. > 	return st->data[i];
  309.   }
  310.   

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

crypto/asn1/x_name.c:222:6: Taking false branch
220.   	for(i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
221.   		entry = sk_X509_NAME_ENTRY_value(a->entries, i);
222.   		if(entry->set != set) {
            ^
223.   			entries = sk_X509_NAME_ENTRY_new_null();
224.   			if(!entries) goto memerr;

crypto/asn1/x_name.c:228:7: 
226.   			set = entry->set;
227.   		}
228. > 		if(!sk_X509_NAME_ENTRY_push(entries, entry)) goto memerr;
229.   	}
230.   	len = ASN1_item_ex_i2d((ASN1_VALUE **)&intname, NULL, &X509_NAME_INTERNAL_it, -1, -1);

crypto/stack/stack.c:249:1: start of procedure sk_push()
  247.   	}
  248.   
  249. > int sk_push(STACK *st, char *data)
  250.   	{
  251.   	return(sk_insert(st,data,st->num));

crypto/stack/stack.c:251:2: Skipping sk_insert(): empty list of specs
  249.   int sk_push(STACK *st, char *data)
  250.   	{
  251.   	return(sk_insert(st,data,st->num));
          ^
  252.   	}
  253.   
