crypto/x509v3/v3_ncons.c:138: error: NULL_DEREFERENCE
  pointer `sub` last assigned on line 137 could be null and is dereferenced at line 138, column 34.
Showing all 44 steps of the trace


crypto/x509v3/v3_ncons.c:113:1: start of procedure v2i_NAME_CONSTRAINTS()
111.   IMPLEMENT_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS)
112.   
113. > static void *v2i_NAME_CONSTRAINTS(const X509V3_EXT_METHOD *method,
114.                                     X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval)
115.   {

crypto/x509v3/v3_ncons.c:118:5: 
116.       int i;
117.       CONF_VALUE tval, *val;
118. >     STACK_OF(GENERAL_SUBTREE) **ptree = NULL;
119.       NAME_CONSTRAINTS *ncons = NULL;
120.       GENERAL_SUBTREE *sub = NULL;

crypto/x509v3/v3_ncons.c:119:5: 
117.       CONF_VALUE tval, *val;
118.       STACK_OF(GENERAL_SUBTREE) **ptree = NULL;
119. >     NAME_CONSTRAINTS *ncons = NULL;
120.       GENERAL_SUBTREE *sub = NULL;
121.       ncons = NAME_CONSTRAINTS_new();

crypto/x509v3/v3_ncons.c:120:5: 
118.       STACK_OF(GENERAL_SUBTREE) **ptree = NULL;
119.       NAME_CONSTRAINTS *ncons = NULL;
120. >     GENERAL_SUBTREE *sub = NULL;
121.       ncons = NAME_CONSTRAINTS_new();
122.       if (!ncons)

crypto/x509v3/v3_ncons.c:121:5: 
119.       NAME_CONSTRAINTS *ncons = NULL;
120.       GENERAL_SUBTREE *sub = NULL;
121. >     ncons = NAME_CONSTRAINTS_new();
122.       if (!ncons)
123.           goto memerr;

crypto/x509v3/v3_ncons.c:111:1: start of procedure NAME_CONSTRAINTS_new()
  109.   
  110.   IMPLEMENT_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE)
  111. > IMPLEMENT_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS)
  112.   
  113.   static void *v2i_NAME_CONSTRAINTS(const X509V3_EXT_METHOD *method,

crypto/asn1/tasn_new.c:74:1: start of procedure ASN1_item_new()
    72.   static void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
    73.   
    74. > ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it)
    75.   {
    76.       ASN1_VALUE *ret = NULL;

crypto/asn1/tasn_new.c:76:5: 
    74.   ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it)
    75.   {
    76. >     ASN1_VALUE *ret = NULL;
    77.       if (ASN1_item_ex_new(&ret, it) > 0)
    78.           return ret;

crypto/asn1/tasn_new.c:77:9: Taking true branch
    75.   {
    76.       ASN1_VALUE *ret = NULL;
    77.       if (ASN1_item_ex_new(&ret, it) > 0)
                  ^
    78.           return ret;
    79.       return NULL;

crypto/asn1/tasn_new.c:78:9: 
    76.       ASN1_VALUE *ret = NULL;
    77.       if (ASN1_item_ex_new(&ret, it) > 0)
    78. >         return ret;
    79.       return NULL;
    80.   }

crypto/asn1/tasn_new.c:80:1: return from a call to ASN1_item_new
    78.           return ret;
    79.       return NULL;
    80. > }
    81.   
    82.   /* Allocate an ASN1 structure */

crypto/x509v3/v3_ncons.c:111:1: return from a call to NAME_CONSTRAINTS_new
  109.   
  110.   IMPLEMENT_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE)
  111. > IMPLEMENT_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS)
  112.   
  113.   static void *v2i_NAME_CONSTRAINTS(const X509V3_EXT_METHOD *method,

crypto/x509v3/v3_ncons.c:122:10: Taking false branch
120.       GENERAL_SUBTREE *sub = NULL;
121.       ncons = NAME_CONSTRAINTS_new();
122.       if (!ncons)
                ^
123.           goto memerr;
124.       for (i = 0; i < sk_CONF_VALUE_num(nval); i++) {

crypto/x509v3/v3_ncons.c:124:10: 
122.       if (!ncons)
123.           goto memerr;
124. >     for (i = 0; i < sk_CONF_VALUE_num(nval); i++) {
125.           val = sk_CONF_VALUE_value(nval, i);
126.           if (!strncmp(val->name, "permitted", 9) && val->name[9]) {

crypto/x509v3/v3_ncons.c:124:21: Condition is true
122.       if (!ncons)
123.           goto memerr;
124.       for (i = 0; i < sk_CONF_VALUE_num(nval); i++) {
                           ^
125.           val = sk_CONF_VALUE_value(nval, i);
126.           if (!strncmp(val->name, "permitted", 9) && val->name[9]) {

crypto/x509v3/v3_ncons.c:124:17: 
122.       if (!ncons)
123.           goto memerr;
124. >     for (i = 0; i < sk_CONF_VALUE_num(nval); i++) {
125.           val = sk_CONF_VALUE_value(nval, i);
126.           if (!strncmp(val->name, "permitted", 9) && val->name[9]) {

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/x509v3/v3_ncons.c:124:17: Loop condition is true. Entering loop body
122.       if (!ncons)
123.           goto memerr;
124.       for (i = 0; i < sk_CONF_VALUE_num(nval); i++) {
                       ^
125.           val = sk_CONF_VALUE_value(nval, i);
126.           if (!strncmp(val->name, "permitted", 9) && val->name[9]) {

crypto/x509v3/v3_ncons.c:125:15: Condition is true
123.           goto memerr;
124.       for (i = 0; i < sk_CONF_VALUE_num(nval); i++) {
125.           val = sk_CONF_VALUE_value(nval, i);
                     ^
126.           if (!strncmp(val->name, "permitted", 9) && val->name[9]) {
127.               ptree = &ncons->permittedSubtrees;

crypto/x509v3/v3_ncons.c:125:9: 
123.           goto memerr;
124.       for (i = 0; i < sk_CONF_VALUE_num(nval); i++) {
125. >         val = sk_CONF_VALUE_value(nval, i);
126.           if (!strncmp(val->name, "permitted", 9) && val->name[9]) {
127.               ptree = &ncons->permittedSubtrees;

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/x509v3/v3_ncons.c:126:14: Taking false branch
124.       for (i = 0; i < sk_CONF_VALUE_num(nval); i++) {
125.           val = sk_CONF_VALUE_value(nval, i);
126.           if (!strncmp(val->name, "permitted", 9) && val->name[9]) {
                    ^
127.               ptree = &ncons->permittedSubtrees;
128.               tval.name = val->name + 10;

crypto/x509v3/v3_ncons.c:129:21: Taking true branch
127.               ptree = &ncons->permittedSubtrees;
128.               tval.name = val->name + 10;
129.           } else if (!strncmp(val->name, "excluded", 8) && val->name[8]) {
                           ^
130.               ptree = &ncons->excludedSubtrees;
131.               tval.name = val->name + 9;

crypto/x509v3/v3_ncons.c:129:58: Taking true branch
127.               ptree = &ncons->permittedSubtrees;
128.               tval.name = val->name + 10;
129.           } else if (!strncmp(val->name, "excluded", 8) && val->name[8]) {
                                                                ^
130.               ptree = &ncons->excludedSubtrees;
131.               tval.name = val->name + 9;

crypto/x509v3/v3_ncons.c:130:13: 
128.               tval.name = val->name + 10;
129.           } else if (!strncmp(val->name, "excluded", 8) && val->name[8]) {
130. >             ptree = &ncons->excludedSubtrees;
131.               tval.name = val->name + 9;
132.           } else {

crypto/x509v3/v3_ncons.c:131:13: 
129.           } else if (!strncmp(val->name, "excluded", 8) && val->name[8]) {
130.               ptree = &ncons->excludedSubtrees;
131. >             tval.name = val->name + 9;
132.           } else {
133.               X509V3err(X509V3_F_V2I_NAME_CONSTRAINTS, X509V3_R_INVALID_SYNTAX);

crypto/x509v3/v3_ncons.c:136:9: 
134.               goto err;
135.           }
136. >         tval.value = val->value;
137.           sub = GENERAL_SUBTREE_new();
138.           if (!v2i_GENERAL_NAME_ex(sub->base, method, ctx, &tval, 1))

crypto/x509v3/v3_ncons.c:137:9: 
135.           }
136.           tval.value = val->value;
137. >         sub = GENERAL_SUBTREE_new();
138.           if (!v2i_GENERAL_NAME_ex(sub->base, method, ctx, &tval, 1))
139.               goto err;

crypto/x509v3/v3_ncons.c:110:1: start of procedure GENERAL_SUBTREE_new()
  108.   
  109.   
  110. > IMPLEMENT_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE)
  111.   IMPLEMENT_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS)
  112.   

crypto/asn1/tasn_new.c:74:1: start of procedure ASN1_item_new()
    72.   static void asn1_primitive_clear(ASN1_VALUE **pval, const ASN1_ITEM *it);
    73.   
    74. > ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it)
    75.   {
    76.       ASN1_VALUE *ret = NULL;

crypto/asn1/tasn_new.c:76:5: 
    74.   ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it)
    75.   {
    76. >     ASN1_VALUE *ret = NULL;
    77.       if (ASN1_item_ex_new(&ret, it) > 0)
    78.           return ret;

crypto/asn1/tasn_new.c:77:9: Taking false branch
    75.   {
    76.       ASN1_VALUE *ret = NULL;
    77.       if (ASN1_item_ex_new(&ret, it) > 0)
                  ^
    78.           return ret;
    79.       return NULL;

crypto/asn1/tasn_new.c:79:5: 
    77.       if (ASN1_item_ex_new(&ret, it) > 0)
    78.           return ret;
    79. >     return NULL;
    80.   }
    81.   

crypto/asn1/tasn_new.c:80:1: return from a call to ASN1_item_new
    78.           return ret;
    79.       return NULL;
    80. > }
    81.   
    82.   /* Allocate an ASN1 structure */

crypto/x509v3/v3_ncons.c:110:1: return from a call to GENERAL_SUBTREE_new
  108.   
  109.   
  110. > IMPLEMENT_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE)
  111.   IMPLEMENT_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS)
  112.   

crypto/x509v3/v3_ncons.c:138:14: 
136.           tval.value = val->value;
137.           sub = GENERAL_SUBTREE_new();
138. >         if (!v2i_GENERAL_NAME_ex(sub->base, method, ctx, &tval, 1))
139.               goto err;
140.           if (!*ptree)
