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


crypto/x509/x509_vfy.c:983:1: start of procedure X509_STORE_CTX_purpose_inherit()
981.    */
982.   
983. > int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose,
984.   				int purpose, int trust)
985.   {

crypto/x509/x509_vfy.c:988:7: Taking false branch
986.   	int idx;
987.   	/* If purpose not set use default */
988.   	if (!purpose) purpose = def_purpose;
             ^
989.   	/* If we have a purpose then check it is valid */
990.   	if (purpose)

crypto/x509/x509_vfy.c:990:6: Taking true branch
988.   	if (!purpose) purpose = def_purpose;
989.   	/* If we have a purpose then check it is valid */
990.   	if (purpose)
            ^
991.   		{
992.   		X509_PURPOSE *ptmp;

crypto/x509/x509_vfy.c:993:3: 
991.   		{
992.   		X509_PURPOSE *ptmp;
993. > 		idx = X509_PURPOSE_get_by_id(purpose);
994.   		if (idx == -1)
995.   			{

crypto/x509v3/v3_purp.c:158:1: start of procedure X509_PURPOSE_get_by_id()
  156.   }
  157.   
  158. > int X509_PURPOSE_get_by_id(int purpose)
  159.   {
  160.   	X509_PURPOSE tmp;

crypto/x509v3/v3_purp.c:162:6: Taking true branch
  160.   	X509_PURPOSE tmp;
  161.   	int idx;
  162.   	if((purpose >= X509_PURPOSE_MIN) && (purpose <= X509_PURPOSE_MAX))
              ^
  163.   		return purpose - X509_PURPOSE_MIN;
  164.   	tmp.purpose = purpose;

crypto/x509v3/v3_purp.c:162:39: Taking false branch
  160.   	X509_PURPOSE tmp;
  161.   	int idx;
  162.   	if((purpose >= X509_PURPOSE_MIN) && (purpose <= X509_PURPOSE_MAX))
                                               ^
  163.   		return purpose - X509_PURPOSE_MIN;
  164.   	tmp.purpose = purpose;

crypto/x509v3/v3_purp.c:164:2: 
  162.   	if((purpose >= X509_PURPOSE_MIN) && (purpose <= X509_PURPOSE_MAX))
  163.   		return purpose - X509_PURPOSE_MIN;
  164. > 	tmp.purpose = purpose;
  165.   	if(!xptable) return -1;
  166.   	idx = sk_X509_PURPOSE_find(xptable, &tmp);

crypto/x509v3/v3_purp.c:165:6: Taking false branch
  163.   		return purpose - X509_PURPOSE_MIN;
  164.   	tmp.purpose = purpose;
  165.   	if(!xptable) return -1;
              ^
  166.   	idx = sk_X509_PURPOSE_find(xptable, &tmp);
  167.   	if(idx == -1) return -1;

crypto/x509v3/v3_purp.c:166:2: Skipping sk_find(): empty list of specs
  164.   	tmp.purpose = purpose;
  165.   	if(!xptable) return -1;
  166.   	idx = sk_X509_PURPOSE_find(xptable, &tmp);
          ^
  167.   	if(idx == -1) return -1;
  168.   	return idx + X509_PURPOSE_COUNT;

crypto/x509v3/v3_purp.c:167:5: Taking false branch
  165.   	if(!xptable) return -1;
  166.   	idx = sk_X509_PURPOSE_find(xptable, &tmp);
  167.   	if(idx == -1) return -1;
             ^
  168.   	return idx + X509_PURPOSE_COUNT;
  169.   }

crypto/x509v3/v3_purp.c:168:2: 
  166.   	idx = sk_X509_PURPOSE_find(xptable, &tmp);
  167.   	if(idx == -1) return -1;
  168. > 	return idx + X509_PURPOSE_COUNT;
  169.   }
  170.   

crypto/x509v3/v3_purp.c:169:1: return from a call to X509_PURPOSE_get_by_id
  167.   	if(idx == -1) return -1;
  168.   	return idx + X509_PURPOSE_COUNT;
  169. > }
  170.   
  171.   int X509_PURPOSE_add(int id, int trust, int flags,

crypto/x509/x509_vfy.c:994:7: Taking false branch
992.   		X509_PURPOSE *ptmp;
993.   		idx = X509_PURPOSE_get_by_id(purpose);
994.   		if (idx == -1)
             ^
995.   			{
996.   			X509err(X509_F_X509_STORE_CTX_PURPOSE_INHERIT,

crypto/x509/x509_vfy.c:1000:3: 
998.   			return 0;
999.   			}
1000. > 		ptmp = X509_PURPOSE_get0(idx);
1001.   		if (ptmp->trust == X509_TRUST_DEFAULT)
1002.   			{

crypto/x509v3/v3_purp.c:140:1: start of procedure X509_PURPOSE_get0()
  138.   }
  139.   
  140. > X509_PURPOSE * X509_PURPOSE_get0(int idx)
  141.   {
  142.   	if(idx < 0) return NULL;

crypto/x509v3/v3_purp.c:142:5: Taking true branch
  140.   X509_PURPOSE * X509_PURPOSE_get0(int idx)
  141.   {
  142.   	if(idx < 0) return NULL;
             ^
  143.   	if(idx < X509_PURPOSE_COUNT) return xstandard + idx;
  144.   	return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);

crypto/x509v3/v3_purp.c:142:14: 
  140.   X509_PURPOSE * X509_PURPOSE_get0(int idx)
  141.   {
  142. > 	if(idx < 0) return NULL;
  143.   	if(idx < X509_PURPOSE_COUNT) return xstandard + idx;
  144.   	return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);

crypto/x509v3/v3_purp.c:145:1: return from a call to X509_PURPOSE_get0
  143.   	if(idx < X509_PURPOSE_COUNT) return xstandard + idx;
  144.   	return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);
  145. > }
  146.   
  147.   int X509_PURPOSE_get_by_sname(char *sname)

crypto/x509/x509_vfy.c:1001:7: 
999.   			}
1000.   		ptmp = X509_PURPOSE_get0(idx);
1001. > 		if (ptmp->trust == X509_TRUST_DEFAULT)
1002.   			{
1003.   			idx = X509_PURPOSE_get_by_id(def_purpose);
