crypto/x509/x509_trs.c:113: error: NULL_DEREFERENCE
  pointer `pt` last assigned on line 112 could be null and is dereferenced at line 113, column 9.
Showing all 17 steps of the trace


crypto/x509/x509_trs.c:105:1: start of procedure X509_check_trust()
103.   
104.   
105. > int X509_check_trust(X509 *x, int id, int flags)
106.   {
107.   	X509_TRUST *pt;

crypto/x509/x509_trs.c:109:5: Taking false branch
107.   	X509_TRUST *pt;
108.   	int idx;
109.   	if(id == -1) return 1;
           ^
110.   	if(!(idx = X509_TRUST_get_by_id(id)))
111.   			return default_trust(id, x, flags);

crypto/x509/x509_trs.c:110:7: 
108.   	int idx;
109.   	if(id == -1) return 1;
110. > 	if(!(idx = X509_TRUST_get_by_id(id)))
111.   			return default_trust(id, x, flags);
112.   	pt = X509_TRUST_get0(idx);

crypto/x509/x509_trs.c:129:1: start of procedure X509_TRUST_get_by_id()
  127.   }
  128.   
  129. > int X509_TRUST_get_by_id(int id)
  130.   {
  131.   	X509_TRUST tmp;

crypto/x509/x509_trs.c:133:6: Taking true branch
  131.   	X509_TRUST tmp;
  132.   	int idx;
  133.   	if((id >= X509_TRUST_MIN) && (id <= X509_TRUST_MAX))
              ^
  134.   				 return id - X509_TRUST_MIN;
  135.   	tmp.trust = id;

crypto/x509/x509_trs.c:133:32: Taking false branch
  131.   	X509_TRUST tmp;
  132.   	int idx;
  133.   	if((id >= X509_TRUST_MIN) && (id <= X509_TRUST_MAX))
                                        ^
  134.   				 return id - X509_TRUST_MIN;
  135.   	tmp.trust = id;

crypto/x509/x509_trs.c:135:2: 
  133.   	if((id >= X509_TRUST_MIN) && (id <= X509_TRUST_MAX))
  134.   				 return id - X509_TRUST_MIN;
  135. > 	tmp.trust = id;
  136.   	if(!trtable) return -1;
  137.   	idx = sk_X509_TRUST_find(trtable, &tmp);

crypto/x509/x509_trs.c:136:6: Taking true branch
  134.   				 return id - X509_TRUST_MIN;
  135.   	tmp.trust = id;
  136.   	if(!trtable) return -1;
              ^
  137.   	idx = sk_X509_TRUST_find(trtable, &tmp);
  138.   	if(idx == -1) return -1;

crypto/x509/x509_trs.c:136:15: 
  134.   				 return id - X509_TRUST_MIN;
  135.   	tmp.trust = id;
  136. > 	if(!trtable) return -1;
  137.   	idx = sk_X509_TRUST_find(trtable, &tmp);
  138.   	if(idx == -1) return -1;

crypto/x509/x509_trs.c:140:1: return from a call to X509_TRUST_get_by_id
  138.   	if(idx == -1) return -1;
  139.   	return idx + X509_TRUST_COUNT;
  140. > }
  141.   
  142.   int X509_TRUST_add(int id, int flags, int (*ck)(X509_TRUST *, X509 *, int),

crypto/x509/x509_trs.c:110:7: Taking false branch
108.   	int idx;
109.   	if(id == -1) return 1;
110.   	if(!(idx = X509_TRUST_get_by_id(id)))
             ^
111.   			return default_trust(id, x, flags);
112.   	pt = X509_TRUST_get0(idx);

crypto/x509/x509_trs.c:112:2: 
110.   	if(!(idx = X509_TRUST_get_by_id(id)))
111.   			return default_trust(id, x, flags);
112. > 	pt = X509_TRUST_get0(idx);
113.   	return pt->check_trust(pt, x, flags);
114.   }

crypto/x509/x509_trs.c:122:1: start of procedure X509_TRUST_get0()
  120.   }
  121.   
  122. > X509_TRUST * X509_TRUST_get0(int idx)
  123.   {
  124.   	if(idx < 0) return NULL;

crypto/x509/x509_trs.c:124:5: Taking true branch
  122.   X509_TRUST * X509_TRUST_get0(int idx)
  123.   {
  124.   	if(idx < 0) return NULL;
             ^
  125.   	if(idx < X509_TRUST_COUNT) return trstandard + idx;
  126.   	return sk_X509_TRUST_value(trtable, idx - X509_TRUST_COUNT);

crypto/x509/x509_trs.c:124:14: 
  122.   X509_TRUST * X509_TRUST_get0(int idx)
  123.   {
  124. > 	if(idx < 0) return NULL;
  125.   	if(idx < X509_TRUST_COUNT) return trstandard + idx;
  126.   	return sk_X509_TRUST_value(trtable, idx - X509_TRUST_COUNT);

crypto/x509/x509_trs.c:127:1: return from a call to X509_TRUST_get0
  125.   	if(idx < X509_TRUST_COUNT) return trstandard + idx;
  126.   	return sk_X509_TRUST_value(trtable, idx - X509_TRUST_COUNT);
  127. > }
  128.   
  129.   int X509_TRUST_get_by_id(int id)

crypto/x509/x509_trs.c:113:2: 
111.   			return default_trust(id, x, flags);
112.   	pt = X509_TRUST_get0(idx);
113. > 	return pt->check_trust(pt, x, flags);
114.   }
115.   

int X509_check_trust(X509 *x, int id, int flags)
{
	X509_TRUST *pt;
	int idx;
	if(id == -1) return 1;
	if(!(idx = X509_TRUST_get_by_id(id)))
			return default_trust(id, x, flags);
	pt = X509_TRUST_get0(idx);
	return pt->check_trust(pt, x, flags);
}
['int X509_check_trust(X509 *x, int id, int flags)\n{\n\tX509_TRUST *pt;\n\tint idx;\n\tif(id == -1) return 1;\n\tif(!(idx = X509_TRUST_get_by_id(id)))\n\t\t\treturn default_trust(id, x, flags);\n\tpt = X509_TRUST_get0(idx);\n\treturn pt->check_trust(pt, x, flags);\n}', 'int X509_TRUST_get_by_id(int id)\n{\n\tX509_TRUST tmp;\n\tint idx;\n\tif((id >= X509_TRUST_MIN) && (id <= X509_TRUST_MAX))\n\t\t\t\t return id - X509_TRUST_MIN;\n\ttmp.trust = id;\n\tif(!trtable) return -1;\n\tidx = sk_X509_TRUST_find(trtable, &tmp);\n\tif(idx == -1) return -1;\n\treturn idx + X509_TRUST_COUNT;\n}', 'X509_TRUST * X509_TRUST_get0(int idx)\n{\n\tif(idx < 0) return NULL;\n\tif(idx < X509_TRUST_COUNT) return trstandard + idx;\n\treturn sk_X509_TRUST_value(trtable, idx - X509_TRUST_COUNT);\n}']