crypto/x509v3/v3_ncons.c:139: error: NULL_DEREFERENCE
  pointer `sub` last assigned on line 138 could be null and is dereferenced at line 139, 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.   

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.   
122.       ncons = NAME_CONSTRAINTS_new();

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

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

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

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

crypto/stack/stack.c:321:1: start of procedure sk_num()
  319.   }
  320.   
  321. > int sk_num(const _STACK *st)
  322.   {
  323.       if (st == NULL)

crypto/stack/stack.c:323:9: Taking false branch
  321.   int sk_num(const _STACK *st)
  322.   {
  323.       if (st == NULL)
                 ^
  324.           return -1;
  325.       return st->num;

crypto/stack/stack.c:325:5: 
  323.       if (st == NULL)
  324.           return -1;
  325. >     return st->num;
  326.   }
  327.   

crypto/stack/stack.c:326:1: return from a call to sk_num
  324.           return -1;
  325.       return st->num;
  326. > }
  327.   
  328.   void *sk_value(const _STACK *st, int i)

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

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

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

crypto/stack/stack.c:328:1: start of procedure sk_value()
  326.   }
  327.   
  328. > void *sk_value(const _STACK *st, int i)
  329.   {
  330.       if (!st || (i < 0) || (i >= st->num))

crypto/stack/stack.c:330:10: Taking false branch
  328.   void *sk_value(const _STACK *st, int i)
  329.   {
  330.       if (!st || (i < 0) || (i >= st->num))
                  ^
  331.           return NULL;
  332.       return st->data[i];

crypto/stack/stack.c:330:17: Taking false branch
  328.   void *sk_value(const _STACK *st, int i)
  329.   {
  330.       if (!st || (i < 0) || (i >= st->num))
                         ^
  331.           return NULL;
  332.       return st->data[i];

crypto/stack/stack.c:330:28: Taking false branch
  328.   void *sk_value(const _STACK *st, int i)
  329.   {
  330.       if (!st || (i < 0) || (i >= st->num))
                                    ^
  331.           return NULL;
  332.       return st->data[i];

crypto/stack/stack.c:332:5: 
  330.       if (!st || (i < 0) || (i >= st->num))
  331.           return NULL;
  332. >     return st->data[i];
  333.   }
  334.   

crypto/stack/stack.c:333:1: return from a call to sk_value
  331.           return NULL;
  332.       return st->data[i];
  333. > }
  334.   
  335.   void *sk_set(_STACK *st, int i, void *value)

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

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

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

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

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

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

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