crypto/x509v3/v3_purp.c:121: error: NULL_DEREFERENCE
  pointer `pt` last assigned on line 120 could be null and is dereferenced at line 121, column 9.
Showing all 35 steps of the trace


crypto/x509v3/v3_purp.c:108:1: start of procedure X509_check_purpose()
106.    * I really can't because it does recalculate hashes and do other non-const
107.    * things. */
108. > int X509_check_purpose(X509 *x, int id, int ca)
109.   {
110.   	int idx;

crypto/x509v3/v3_purp.c:112:7: Taking true branch
110.   	int idx;
111.   	const X509_PURPOSE *pt;
112.   	if(!(x->ex_flags & EXFLAG_SET)) {
             ^
113.   		CRYPTO_w_lock(CRYPTO_LOCK_X509);
114.   		x509v3_cache_extensions(x);

crypto/x509v3/v3_purp.c:113:3: 
111.   	const X509_PURPOSE *pt;
112.   	if(!(x->ex_flags & EXFLAG_SET)) {
113. > 		CRYPTO_w_lock(CRYPTO_LOCK_X509);
114.   		x509v3_cache_extensions(x);
115.   		CRYPTO_w_unlock(CRYPTO_LOCK_X509);

crypto/cryptlib.c:448:1: start of procedure CRYPTO_lock()
  446.   	}
  447.   
  448. > void CRYPTO_lock(int mode, int type, const char *file, int line)
  449.   	{
  450.   #ifdef LOCK_DEBUG

crypto/cryptlib.c:473:6: Taking false branch
  471.   		}
  472.   #endif
  473.   	if (type < 0)
              ^
  474.   		{
  475.   		if (dynlock_lock_callback != NULL)

crypto/cryptlib.c:488:7: Taking true branch
  486.   		}
  487.   	else
  488.   		if (locking_callback != NULL)
               ^
  489.   			locking_callback(mode,type,file,line);
  490.   	}

crypto/cryptlib.c:489:4: Skipping __function_pointer__(): unresolved function pointer
  487.   	else
  488.   		if (locking_callback != NULL)
  489.   			locking_callback(mode,type,file,line);
            ^
  490.   	}
  491.   

crypto/cryptlib.c:473:2: 
  471.   		}
  472.   #endif
  473. > 	if (type < 0)
  474.   		{
  475.   		if (dynlock_lock_callback != NULL)

crypto/cryptlib.c:490:2: return from a call to CRYPTO_lock
  488.   		if (locking_callback != NULL)
  489.   			locking_callback(mode,type,file,line);
  490.   	}
          ^
  491.   
  492.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

crypto/x509v3/v3_purp.c:114:3: Skipping x509v3_cache_extensions(): empty list of specs
112.   	if(!(x->ex_flags & EXFLAG_SET)) {
113.   		CRYPTO_w_lock(CRYPTO_LOCK_X509);
114.   		x509v3_cache_extensions(x);
         ^
115.   		CRYPTO_w_unlock(CRYPTO_LOCK_X509);
116.   	}

crypto/x509v3/v3_purp.c:115:3: 
113.   		CRYPTO_w_lock(CRYPTO_LOCK_X509);
114.   		x509v3_cache_extensions(x);
115. > 		CRYPTO_w_unlock(CRYPTO_LOCK_X509);
116.   	}
117.   	if(id == -1) return 1;

crypto/cryptlib.c:448:1: start of procedure CRYPTO_lock()
  446.   	}
  447.   
  448. > void CRYPTO_lock(int mode, int type, const char *file, int line)
  449.   	{
  450.   #ifdef LOCK_DEBUG

crypto/cryptlib.c:473:6: Taking false branch
  471.   		}
  472.   #endif
  473.   	if (type < 0)
              ^
  474.   		{
  475.   		if (dynlock_lock_callback != NULL)

crypto/cryptlib.c:488:7: Taking true branch
  486.   		}
  487.   	else
  488.   		if (locking_callback != NULL)
               ^
  489.   			locking_callback(mode,type,file,line);
  490.   	}

crypto/cryptlib.c:489:4: Skipping __function_pointer__(): unresolved function pointer
  487.   	else
  488.   		if (locking_callback != NULL)
  489.   			locking_callback(mode,type,file,line);
            ^
  490.   	}
  491.   

crypto/cryptlib.c:473:2: 
  471.   		}
  472.   #endif
  473. > 	if (type < 0)
  474.   		{
  475.   		if (dynlock_lock_callback != NULL)

crypto/cryptlib.c:490:2: return from a call to CRYPTO_lock
  488.   		if (locking_callback != NULL)
  489.   			locking_callback(mode,type,file,line);
  490.   	}
          ^
  491.   
  492.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

crypto/x509v3/v3_purp.c:117:5: Taking false branch
115.   		CRYPTO_w_unlock(CRYPTO_LOCK_X509);
116.   	}
117.   	if(id == -1) return 1;
           ^
118.   	idx = X509_PURPOSE_get_by_id(id);
119.   	if(idx == -1) return -1;

crypto/x509v3/v3_purp.c:118:2: 
116.   	}
117.   	if(id == -1) return 1;
118. > 	idx = X509_PURPOSE_get_by_id(id);
119.   	if(idx == -1) return -1;
120.   	pt = X509_PURPOSE_get0(idx);

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/x509v3/v3_purp.c:119:5: Taking false branch
117.   	if(id == -1) return 1;
118.   	idx = X509_PURPOSE_get_by_id(id);
119.   	if(idx == -1) return -1;
           ^
120.   	pt = X509_PURPOSE_get0(idx);
121.   	return pt->check_purpose(pt, x, ca);

crypto/x509v3/v3_purp.c:120:2: 
118.   	idx = X509_PURPOSE_get_by_id(id);
119.   	if(idx == -1) return -1;
120. > 	pt = X509_PURPOSE_get0(idx);
121.   	return pt->check_purpose(pt, x, ca);
122.   }

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/x509v3/v3_purp.c:121:2: 
119.   	if(idx == -1) return -1;
120.   	pt = X509_PURPOSE_get0(idx);
121. > 	return pt->check_purpose(pt, x, ca);
122.   }
123.   
