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


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

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

crypto/x509/x509_lu.c:291:2: 
289.   	int i,j;
290.   
291. > 	tmp=X509_OBJECT_retrieve_by_subject(ctx->objs,type,name);
292.   
293.   	if (tmp == NULL || type == X509_LU_CRL)

crypto/x509/x509_lu.c:472:1: start of procedure X509_OBJECT_retrieve_by_subject()
  470.   	}
  471.   
  472. > X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, int type,
  473.   	     X509_NAME *name)
  474.   {

crypto/x509/x509_lu.c:476:2: 
  474.   {
  475.   	int idx;
  476. > 	idx = X509_OBJECT_idx_by_subject(h, type, name);
  477.   	if (idx==-1) return NULL;
  478.   	return sk_X509_OBJECT_value(h, idx);

crypto/x509/x509_lu.c:466:1: start of procedure X509_OBJECT_idx_by_subject()
    464.   
    465.   
    466. > int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type,
    467.   	     X509_NAME *name)
    468.   	{

crypto/x509/x509_lu.c:469:2: Skipping x509_object_idx_cnt(): empty list of specs
    467.   	     X509_NAME *name)
    468.   	{
    469.   	return x509_object_idx_cnt(h, type, name, NULL);
            ^
    470.   	}
    471.   

crypto/x509/x509_lu.c:470:2: return from a call to X509_OBJECT_idx_by_subject
    468.   	{
    469.   	return x509_object_idx_cnt(h, type, name, NULL);
    470.   	}
            ^
    471.   
    472.   X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, int type,

crypto/x509/x509_lu.c:477:6: Taking false branch
  475.   	int idx;
  476.   	idx = X509_OBJECT_idx_by_subject(h, type, name);
  477.   	if (idx==-1) return NULL;
              ^
  478.   	return sk_X509_OBJECT_value(h, idx);
  479.   }

crypto/x509/x509_lu.c:478:9: Condition is true
  476.   	idx = X509_OBJECT_idx_by_subject(h, type, name);
  477.   	if (idx==-1) return NULL;
  478.   	return sk_X509_OBJECT_value(h, idx);
                 ^
  479.   }
  480.   

crypto/x509/x509_lu.c:478:2: 
  476.   	idx = X509_OBJECT_idx_by_subject(h, type, name);
  477.   	if (idx==-1) return NULL;
  478. > 	return sk_X509_OBJECT_value(h, idx);
  479.   }
  480.   

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

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

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

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

crypto/stack/stack.c:311:2: 
    309.   {
    310.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
    311. > 	return st->data[i];
    312.   }
    313.   

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

crypto/x509/x509_lu.c:479:1: return from a call to X509_OBJECT_retrieve_by_subject
  477.   	if (idx==-1) return NULL;
  478.   	return sk_X509_OBJECT_value(h, idx);
  479. > }
  480.   
  481.   STACK_OF(X509)* X509_STORE_get1_certs(X509_STORE_CTX *ctx, X509_NAME *nm)

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

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

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

crypto/x509/x509_lu.c:295:32: Condition is true
293.   	if (tmp == NULL || type == X509_LU_CRL)
294.   		{
295.   		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
                                      ^
296.   			{
297.   			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);

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

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

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

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

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

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

crypto/x509/x509_lu.c:297:7: Condition is true
295.   		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
296.   			{
297.   			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);
             ^
298.   			j=X509_LOOKUP_by_subject(lu,type,name,&stmp);
299.   			if (j < 0)

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

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

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

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

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

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

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

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;
