crypto/x509/x509_vfy.c:811: error: NULL_DEREFERENCE
  pointer `ptmp` last assigned on line 810 could be null and is dereferenced at line 811, column 7.
Showing all 20 steps of the trace


crypto/x509/x509_vfy.c:793:1: start of procedure X509_STORE_CTX_purpose_inherit()
791.    */
792.   
793. > int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose,
794.   				int purpose, int trust)
795.   {

crypto/x509/x509_vfy.c:798:7: Taking false branch
796.   	int idx;
797.   	/* If purpose not set use default */
798.   	if (!purpose) purpose = def_purpose;
             ^
799.   	/* If we have a purpose then check it is valid */
800.   	if (purpose)

crypto/x509/x509_vfy.c:800:6: Taking true branch
798.   	if (!purpose) purpose = def_purpose;
799.   	/* If we have a purpose then check it is valid */
800.   	if (purpose)
            ^
801.   		{
802.   		X509_PURPOSE *ptmp;

crypto/x509/x509_vfy.c:803:3: 
801.   		{
802.   		X509_PURPOSE *ptmp;
803. > 		idx = X509_PURPOSE_get_by_id(purpose);
804.   		if (idx == -1)
805.   			{

crypto/x509v3/v3_purp.c:148:1: start of procedure X509_PURPOSE_get_by_id()
  146.   
  147.   
  148. > int X509_PURPOSE_get_by_id(int purpose)
  149.   {
  150.   	X509_PURPOSE tmp;

crypto/x509v3/v3_purp.c:152:6: Taking true branch
  150.   	X509_PURPOSE tmp;
  151.   	int idx;
  152.   	if((purpose >= X509_PURPOSE_MIN) && (purpose <= X509_PURPOSE_MAX))
              ^
  153.   		return purpose - X509_PURPOSE_MIN;
  154.   	tmp.purpose = purpose;

crypto/x509v3/v3_purp.c:152:39: Taking false branch
  150.   	X509_PURPOSE tmp;
  151.   	int idx;
  152.   	if((purpose >= X509_PURPOSE_MIN) && (purpose <= X509_PURPOSE_MAX))
                                               ^
  153.   		return purpose - X509_PURPOSE_MIN;
  154.   	tmp.purpose = purpose;

crypto/x509v3/v3_purp.c:154:2: 
  152.   	if((purpose >= X509_PURPOSE_MIN) && (purpose <= X509_PURPOSE_MAX))
  153.   		return purpose - X509_PURPOSE_MIN;
  154. > 	tmp.purpose = purpose;
  155.   	if(!xptable) return -1;
  156.   	idx = sk_X509_PURPOSE_find(xptable, &tmp);

crypto/x509v3/v3_purp.c:155:6: Taking false branch
  153.   		return purpose - X509_PURPOSE_MIN;
  154.   	tmp.purpose = purpose;
  155.   	if(!xptable) return -1;
              ^
  156.   	idx = sk_X509_PURPOSE_find(xptable, &tmp);
  157.   	if(idx == -1) return -1;

crypto/x509v3/v3_purp.c:156:2: Skipping sk_find(): empty list of specs
  154.   	tmp.purpose = purpose;
  155.   	if(!xptable) return -1;
  156.   	idx = sk_X509_PURPOSE_find(xptable, &tmp);
          ^
  157.   	if(idx == -1) return -1;
  158.   	return idx + X509_PURPOSE_COUNT;

crypto/x509v3/v3_purp.c:157:5: Taking false branch
  155.   	if(!xptable) return -1;
  156.   	idx = sk_X509_PURPOSE_find(xptable, &tmp);
  157.   	if(idx == -1) return -1;
             ^
  158.   	return idx + X509_PURPOSE_COUNT;
  159.   }

crypto/x509v3/v3_purp.c:158:2: 
  156.   	idx = sk_X509_PURPOSE_find(xptable, &tmp);
  157.   	if(idx == -1) return -1;
  158. > 	return idx + X509_PURPOSE_COUNT;
  159.   }
  160.   

crypto/x509v3/v3_purp.c:159:1: return from a call to X509_PURPOSE_get_by_id
  157.   	if(idx == -1) return -1;
  158.   	return idx + X509_PURPOSE_COUNT;
  159. > }
  160.   
  161.   int X509_PURPOSE_add(int id, int trust, int flags,

crypto/x509/x509_vfy.c:804:7: Taking false branch
802.   		X509_PURPOSE *ptmp;
803.   		idx = X509_PURPOSE_get_by_id(purpose);
804.   		if (idx == -1)
             ^
805.   			{
806.   			X509err(X509_F_X509_STORE_CTX_PURPOSE_INHERIT,

crypto/x509/x509_vfy.c:810:3: 
808.   			return 0;
809.   			}
810. > 		ptmp = X509_PURPOSE_get0(idx);
811.   		if (ptmp->trust == X509_TRUST_DEFAULT)
812.   			{

crypto/x509v3/v3_purp.c:129:1: start of procedure X509_PURPOSE_get0()
  127.   }
  128.   
  129. > X509_PURPOSE * X509_PURPOSE_get0(int idx)
  130.   {
  131.   	if(idx < 0) return NULL;

crypto/x509v3/v3_purp.c:131:5: Taking true branch
  129.   X509_PURPOSE * X509_PURPOSE_get0(int idx)
  130.   {
  131.   	if(idx < 0) return NULL;
             ^
  132.   	if(idx < X509_PURPOSE_COUNT) return xstandard + idx;
  133.   	return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);

crypto/x509v3/v3_purp.c:131:14: 
  129.   X509_PURPOSE * X509_PURPOSE_get0(int idx)
  130.   {
  131. > 	if(idx < 0) return NULL;
  132.   	if(idx < X509_PURPOSE_COUNT) return xstandard + idx;
  133.   	return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);

crypto/x509v3/v3_purp.c:134:1: return from a call to X509_PURPOSE_get0
  132.   	if(idx < X509_PURPOSE_COUNT) return xstandard + idx;
  133.   	return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);
  134. > }
  135.   
  136.   int X509_PURPOSE_get_by_sname(char *sname)

crypto/x509/x509_vfy.c:811:7: 
809.   			}
810.   		ptmp = X509_PURPOSE_get0(idx);
811. > 		if (ptmp->trust == X509_TRUST_DEFAULT)
812.   			{
813.   			idx = X509_PURPOSE_get_by_id(def_purpose);
