crypto/x509/x509_lu.c:296: error: NULL_DEREFERENCE
  pointer `lu` last assigned on line 295 could be null and is dereferenced by call to `X509_LOOKUP_by_subject()` at line 296, column 6.
Showing all 20 steps of the trace


crypto/x509/x509_lu.c:281:1: start of procedure X509_STORE_get_by_subject()
279.   	}
280.   
281. > int X509_STORE_get_by_subject(X509_STORE_CTX *vs, int type, X509_NAME *name,
282.   	     X509_OBJECT *ret)
283.   	{

crypto/x509/x509_lu.c:284:2: 
282.   	     X509_OBJECT *ret)
283.   	{
284. > 	X509_STORE *ctx=vs->ctx;
285.   	X509_LOOKUP *lu;
286.   	X509_OBJECT stmp,*tmp;

crypto/x509/x509_lu.c:289:2: Skipping X509_OBJECT_retrieve_by_subject(): empty list of specs
287.   	int i,j;
288.   
289.   	tmp=X509_OBJECT_retrieve_by_subject(ctx->objs,type,name);
        ^
290.   
291.   	if (tmp == NULL)

crypto/x509/x509_lu.c:291:6: Taking true branch
289.   	tmp=X509_OBJECT_retrieve_by_subject(ctx->objs,type,name);
290.   
291.   	if (tmp == NULL)
            ^
292.   		{
293.   		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)

crypto/x509/x509_lu.c:293:8: 
291.   	if (tmp == NULL)
292.   		{
293. > 		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
294.   			{
295.   			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);

crypto/x509/x509_lu.c:293:30: 
291.   	if (tmp == NULL)
292.   		{
293. > 		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
294.   			{
295.   			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);

crypto/stack/stack.c:301:1: start of procedure sk_num()
  299.   	}
  300.   
  301. > int sk_num(const STACK *st)
  302.   {
  303.   	if(st == NULL) return -1;

crypto/stack/stack.c:303:5: Taking false branch
  301.   int sk_num(const STACK *st)
  302.   {
  303.   	if(st == NULL) return -1;
             ^
  304.   	return st->num;
  305.   }

crypto/stack/stack.c:304:2: 
  302.   {
  303.   	if(st == NULL) return -1;
  304. > 	return st->num;
  305.   }
  306.   

crypto/stack/stack.c:305:1: return from a call to sk_num
  303.   	if(st == NULL) return -1;
  304.   	return st->num;
  305. > }
  306.   
  307.   char *sk_value(const STACK *st, int i)

crypto/x509/x509_lu.c:293:30: Loop condition is true. Entering loop body
291.   	if (tmp == NULL)
292.   		{
293.   		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
                                    ^
294.   			{
295.   			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);

crypto/x509/x509_lu.c:295:4: 
293.   		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
294.   			{
295. > 			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);
296.   			j=X509_LOOKUP_by_subject(lu,type,name,&stmp);
297.   			if (j < 0)

crypto/stack/stack.c:307:1: start of procedure sk_value()
  305.   }
  306.   
  307. > char *sk_value(const STACK *st, int i)
  308.   {
  309.   	if(!st || (i < 0) || (i >= st->num)) return NULL;

crypto/stack/stack.c:309:6: Taking false branch
  307.   char *sk_value(const STACK *st, int i)
  308.   {
  309.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
              ^
  310.   	return st->data[i];
  311.   }

crypto/stack/stack.c:309:13: Taking true branch
  307.   char *sk_value(const STACK *st, int i)
  308.   {
  309.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                     ^
  310.   	return st->data[i];
  311.   }

crypto/stack/stack.c:309:39: 
  307.   char *sk_value(const STACK *st, int i)
  308.   {
  309. > 	if(!st || (i < 0) || (i >= st->num)) return NULL;
  310.   	return st->data[i];
  311.   }

crypto/stack/stack.c:311:1: return from a call to sk_value
  309.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
  310.   	return st->data[i];
  311. > }
  312.   
  313.   char *sk_set(STACK *st, int i, char *value)

crypto/x509/x509_lu.c:296:4: 
294.   			{
295.   			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);
296. > 			j=X509_LOOKUP_by_subject(lu,type,name,&stmp);
297.   			if (j < 0)
298.   				{

crypto/x509/x509_lu.c:122:1: start of procedure X509_LOOKUP_by_subject()
  120.   	}
  121.   
  122. > int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name,
  123.   	     X509_OBJECT *ret)
  124.   	{

crypto/x509/x509_lu.c:125:7: 
  123.   	     X509_OBJECT *ret)
  124.   	{
  125. > 	if ((ctx->method == NULL) || (ctx->method->get_by_subject == NULL))
  126.   		return X509_LU_FAIL;
  127.   	if (ctx->skip) return 0;
