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


crypto/x509/x509_vfy.c:789:1: start of procedure X509_STORE_CTX_purpose_inherit()
787.    */
788.   
789. > int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose,
790.   				int purpose, int trust)
791.   {

crypto/x509/x509_vfy.c:794:6: Taking false branch
792.   	int idx;
793.   	/* If purpose not set use default */
794.   	if(!purpose) purpose = def_purpose;
            ^
795.   	/* If we have a purpose then check it is valid */
796.   	if(purpose) {

crypto/x509/x509_vfy.c:796:5: Taking true branch
794.   	if(!purpose) purpose = def_purpose;
795.   	/* If we have a purpose then check it is valid */
796.   	if(purpose) {
           ^
797.   		X509_PURPOSE *ptmp;
798.   		idx = X509_PURPOSE_get_by_id(purpose);

crypto/x509/x509_vfy.c:798:3: 
796.   	if(purpose) {
797.   		X509_PURPOSE *ptmp;
798. > 		idx = X509_PURPOSE_get_by_id(purpose);
799.   		if(idx == -1) {
800.   			X509err(X509_F_X509_STORE_CTX_PURPOSE_INHERIT,

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

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

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

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

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

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

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

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

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

crypto/x509/x509_vfy.c:799:6: Taking false branch
797.   		X509_PURPOSE *ptmp;
798.   		idx = X509_PURPOSE_get_by_id(purpose);
799.   		if(idx == -1) {
            ^
800.   			X509err(X509_F_X509_STORE_CTX_PURPOSE_INHERIT,
801.   						X509_R_UNKNOWN_PURPOSE_ID);

crypto/x509/x509_vfy.c:804:3: 
802.   			return 0;
803.   		}
804. > 		ptmp = X509_PURPOSE_get0(idx);
805.   		if(ptmp->trust == X509_TRUST_DEFAULT) {
806.   			idx = X509_PURPOSE_get_by_id(def_purpose);

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

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

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

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

crypto/x509/x509_vfy.c:805:6: 
803.   		}
804.   		ptmp = X509_PURPOSE_get0(idx);
805. > 		if(ptmp->trust == X509_TRUST_DEFAULT) {
806.   			idx = X509_PURPOSE_get_by_id(def_purpose);
807.   			if(idx == -1) {
