crypto/x509/x_name.c:298: error: NULL_DEREFERENCE
  pointer `entries` last assigned on line 282 could be null and is dereferenced by call to `sk_push()` at line 298, column 14.
Showing all 30 steps of the trace


crypto/x509/x_name.c:272:1: start of procedure x509_name_encode()
270.   }
271.   
272. > static int x509_name_encode(X509_NAME *a)
273.   {
274.       union {

crypto/x509/x_name.c:274:5: 
272.   static int x509_name_encode(X509_NAME *a)
273.   {
274. >     union {
275.           STACK_OF(STACK_OF_X509_NAME_ENTRY) *s;
276.           ASN1_VALUE *a;

crypto/x509/x_name.c:282:5: 
280.       int len;
281.       unsigned char *p;
282. >     STACK_OF(X509_NAME_ENTRY) *entries = NULL;
283.       X509_NAME_ENTRY *entry;
284.       int i, set = -1;

crypto/x509/x_name.c:284:5: 
282.       STACK_OF(X509_NAME_ENTRY) *entries = NULL;
283.       X509_NAME_ENTRY *entry;
284. >     int i, set = -1;
285.       intname.s = sk_STACK_OF_X509_NAME_ENTRY_new_null();
286.       if (!intname.s)

crypto/x509/x_name.c:285:5: 
283.       X509_NAME_ENTRY *entry;
284.       int i, set = -1;
285. >     intname.s = sk_STACK_OF_X509_NAME_ENTRY_new_null();
286.       if (!intname.s)
287.           goto memerr;

crypto/stack/stack.c:149:1: start of procedure sk_new_null()
  147.   }
  148.   
  149. > _STACK *sk_new_null(void)
  150.   {
  151.       return sk_new((int (*)(const void *, const void *))0);

crypto/stack/stack.c:151:5: Skipping sk_new(): empty list of specs
  149.   _STACK *sk_new_null(void)
  150.   {
  151.       return sk_new((int (*)(const void *, const void *))0);
             ^
  152.   }
  153.   

crypto/stack/stack.c:152:1: return from a call to sk_new_null
  150.   {
  151.       return sk_new((int (*)(const void *, const void *))0);
  152. > }
  153.   
  154.   _STACK *sk_new(int (*c) (const void *, const void *))

crypto/x509/x_name.c:286:10: Taking false branch
284.       int i, set = -1;
285.       intname.s = sk_STACK_OF_X509_NAME_ENTRY_new_null();
286.       if (!intname.s)
                ^
287.           goto memerr;
288.       for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {

crypto/x509/x_name.c:288:10: 
286.       if (!intname.s)
287.           goto memerr;
288. >     for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
289.           entry = sk_X509_NAME_ENTRY_value(a->entries, i);
290.           if (entry->set != set) {

crypto/x509/x_name.c:288:21: Condition is true
286.       if (!intname.s)
287.           goto memerr;
288.       for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
                           ^
289.           entry = sk_X509_NAME_ENTRY_value(a->entries, i);
290.           if (entry->set != set) {

crypto/x509/x_name.c:288:17: 
286.       if (!intname.s)
287.           goto memerr;
288. >     for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
289.           entry = sk_X509_NAME_ENTRY_value(a->entries, i);
290.           if (entry->set != set) {

crypto/stack/stack.c:327:1: start of procedure sk_num()
  325.   }
  326.   
  327. > int sk_num(const _STACK *st)
  328.   {
  329.       if (st == NULL)

crypto/stack/stack.c:329:9: Taking false branch
  327.   int sk_num(const _STACK *st)
  328.   {
  329.       if (st == NULL)
                 ^
  330.           return -1;
  331.       return st->num;

crypto/stack/stack.c:331:5: 
  329.       if (st == NULL)
  330.           return -1;
  331. >     return st->num;
  332.   }
  333.   

crypto/stack/stack.c:332:1: return from a call to sk_num
  330.           return -1;
  331.       return st->num;
  332. > }
  333.   
  334.   void *sk_value(const _STACK *st, int i)

crypto/x509/x_name.c:288:17: Loop condition is true. Entering loop body
286.       if (!intname.s)
287.           goto memerr;
288.       for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
                       ^
289.           entry = sk_X509_NAME_ENTRY_value(a->entries, i);
290.           if (entry->set != set) {

crypto/x509/x_name.c:289:17: Condition is true
287.           goto memerr;
288.       for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
289.           entry = sk_X509_NAME_ENTRY_value(a->entries, i);
                       ^
290.           if (entry->set != set) {
291.               entries = sk_X509_NAME_ENTRY_new_null();

crypto/x509/x_name.c:289:9: 
287.           goto memerr;
288.       for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
289. >         entry = sk_X509_NAME_ENTRY_value(a->entries, i);
290.           if (entry->set != set) {
291.               entries = sk_X509_NAME_ENTRY_new_null();

crypto/stack/stack.c:334:1: start of procedure sk_value()
  332.   }
  333.   
  334. > void *sk_value(const _STACK *st, int i)
  335.   {
  336.       if (!st || (i < 0) || (i >= st->num))

crypto/stack/stack.c:336:10: Taking false branch
  334.   void *sk_value(const _STACK *st, int i)
  335.   {
  336.       if (!st || (i < 0) || (i >= st->num))
                  ^
  337.           return NULL;
  338.       return st->data[i];

crypto/stack/stack.c:336:17: Taking false branch
  334.   void *sk_value(const _STACK *st, int i)
  335.   {
  336.       if (!st || (i < 0) || (i >= st->num))
                         ^
  337.           return NULL;
  338.       return st->data[i];

crypto/stack/stack.c:336:28: Taking false branch
  334.   void *sk_value(const _STACK *st, int i)
  335.   {
  336.       if (!st || (i < 0) || (i >= st->num))
                                    ^
  337.           return NULL;
  338.       return st->data[i];

crypto/stack/stack.c:338:5: 
  336.       if (!st || (i < 0) || (i >= st->num))
  337.           return NULL;
  338. >     return st->data[i];
  339.   }
  340.   

crypto/stack/stack.c:339:1: return from a call to sk_value
  337.           return NULL;
  338.       return st->data[i];
  339. > }
  340.   
  341.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x_name.c:290:13: Taking false branch
288.       for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
289.           entry = sk_X509_NAME_ENTRY_value(a->entries, i);
290.           if (entry->set != set) {
                   ^
291.               entries = sk_X509_NAME_ENTRY_new_null();
292.               if (!entries)

crypto/x509/x_name.c:298:14: Condition is true
296.               set = entry->set;
297.           }
298.           if (!sk_X509_NAME_ENTRY_push(entries, entry))
                    ^
299.               goto memerr;
300.       }

crypto/x509/x_name.c:298:14: Condition is true
296.               set = entry->set;
297.           }
298.           if (!sk_X509_NAME_ENTRY_push(entries, entry))
                    ^
299.               goto memerr;
300.       }

crypto/stack/stack.c:268:1: start of procedure sk_push()
  266.   }
  267.   
  268. > int sk_push(_STACK *st, void *data)
  269.   {
  270.       return (sk_insert(st, data, st->num));

crypto/stack/stack.c:270:5: Skipping sk_insert(): empty list of specs
  268.   int sk_push(_STACK *st, void *data)
  269.   {
  270.       return (sk_insert(st, data, st->num));
             ^
  271.   }
  272.   
