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


crypto/x509/x509_lu.c:289:1: start of procedure X509_STORE_get_by_subject()
287.   	}
288.   
289. > int X509_STORE_get_by_subject(X509_STORE_CTX *vs, int type, X509_NAME *name,
290.   	     X509_OBJECT *ret)
291.   	{

crypto/x509/x509_lu.c:292:2: 
290.   	     X509_OBJECT *ret)
291.   	{
292. > 	X509_STORE *ctx=vs->ctx;
293.   	X509_LOOKUP *lu;
294.   	X509_OBJECT stmp,*tmp;

crypto/x509/x509_lu.c:297:2: 
295.   	int i,j;
296.   
297. > 	tmp=X509_OBJECT_retrieve_by_subject(ctx->certs,type,name);
298.   
299.   	if (tmp == NULL)

crypto/x509/x509_lu.c:358:1: start of procedure X509_OBJECT_retrieve_by_subject()
  356.   	}
  357.   
  358. > X509_OBJECT *X509_OBJECT_retrieve_by_subject(LHASH *h, int type,
  359.   	     X509_NAME *name)
  360.   	{

crypto/x509/x509_lu.c:367:2: 
  365.   	X509_CRL_INFO crl_info_s;
  366.   
  367. > 	stmp.type=type;
  368.   	switch (type)
  369.   		{

crypto/x509/x509_lu.c:368:2: 
  366.   
  367.   	stmp.type=type;
  368. > 	switch (type)
  369.   		{
  370.   	case X509_LU_X509:

crypto/x509/x509_lu.c:370:2: Switch condition is false. Skipping switch case
  368.   	switch (type)
  369.   		{
  370.   	case X509_LU_X509:
          ^
  371.   		stmp.data.x509= &x509_s;
  372.   		x509_s.cert_info= &cinf_s;

crypto/x509/x509_lu.c:375:2: Switch condition is false. Skipping switch case
  373.   		cinf_s.subject=name;
  374.   		break;
  375.   	case X509_LU_CRL:
          ^
  376.   		stmp.data.crl= &crl_s;
  377.   		crl_s.crl= &crl_info_s;

crypto/x509/x509_lu.c:382:3: 
  380.   	default:
  381.   		/* abort(); */
  382. > 		return NULL;
  383.   		}
  384.   

crypto/x509/x509_lu.c:387:2: return from a call to X509_OBJECT_retrieve_by_subject
  385.   	tmp=(X509_OBJECT *)lh_retrieve(h,&stmp);
  386.   	return(tmp);
  387.   	}
          ^
  388.   
  389.   X509_STORE_CTX *X509_STORE_CTX_new(void)

crypto/x509/x509_lu.c:299:6: Taking true branch
297.   	tmp=X509_OBJECT_retrieve_by_subject(ctx->certs,type,name);
298.   
299.   	if (tmp == NULL)
            ^
300.   		{
301.   		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)

crypto/x509/x509_lu.c:301:8: 
299.   	if (tmp == NULL)
300.   		{
301. > 		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
302.   			{
303.   			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);

crypto/x509/x509_lu.c:301:30: 
299.   	if (tmp == NULL)
300.   		{
301. > 		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
302.   			{
303.   			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);

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

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

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

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

crypto/x509/x509_lu.c:301:30: Loop condition is true. Entering loop body
299.   	if (tmp == NULL)
300.   		{
301.   		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
                                    ^
302.   			{
303.   			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);

crypto/x509/x509_lu.c:303:4: 
301.   		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
302.   			{
303. > 			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);
304.   			j=X509_LOOKUP_by_subject(lu,type,name,&stmp);
305.   			if (j < 0)

crypto/stack/stack.c:305:1: start of procedure sk_value()
  303.   }
  304.   
  305. > char *sk_value(const STACK *st, int i)
  306.   {
  307.   	if(st == NULL) return NULL;

crypto/stack/stack.c:307:5: Taking true branch
  305.   char *sk_value(const STACK *st, int i)
  306.   {
  307.   	if(st == NULL) return NULL;
             ^
  308.   	return st->data[i];
  309.   }

crypto/stack/stack.c:307:17: 
  305.   char *sk_value(const STACK *st, int i)
  306.   {
  307. > 	if(st == NULL) return NULL;
  308.   	return st->data[i];
  309.   }

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

crypto/x509/x509_lu.c:304:4: 
302.   			{
303.   			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);
304. > 			j=X509_LOOKUP_by_subject(lu,type,name,&stmp);
305.   			if (j < 0)
306.   				{

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

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