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


crypto/x509/x509_lu.c:302:1: start of procedure X509_STORE_get_by_subject()
300.   	}
301.   
302. > int X509_STORE_get_by_subject(X509_STORE_CTX *vs, int type, X509_NAME *name,
303.   	     X509_OBJECT *ret)
304.   	{

crypto/x509/x509_lu.c:305:2: 
303.   	     X509_OBJECT *ret)
304.   	{
305. > 	X509_STORE *ctx=vs->ctx;
306.   	X509_LOOKUP *lu;
307.   	X509_OBJECT stmp,*tmp;

crypto/x509/x509_lu.c:310:2: 
308.   	int i,j;
309.   
310. > 	CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
311.   	tmp=X509_OBJECT_retrieve_by_subject(ctx->objs,type,name);
312.   	CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);

crypto/lock.c:426:1: start of procedure CRYPTO_lock()
  424.   	}
  425.   
  426. > void CRYPTO_lock(int mode, int type, const char *file, int line)
  427.   	{
  428.   #ifdef LOCK_DEBUG

crypto/lock.c:453:6: Taking false branch
  451.   		}
  452.   #endif
  453.   	if (type < 0)
              ^
  454.   		{
  455.   		if (dynlock_lock_callback != NULL)

crypto/lock.c:468:7: Taking true branch
  466.   		}
  467.   	else
  468.   		if (locking_callback != NULL)
               ^
  469.   			locking_callback(mode,type,file,line);
  470.   	}

crypto/lock.c:469:4: Skipping __function_pointer__(): unresolved function pointer
  467.   	else
  468.   		if (locking_callback != NULL)
  469.   			locking_callback(mode,type,file,line);
            ^
  470.   	}
  471.   

crypto/lock.c:453:2: 
  451.   		}
  452.   #endif
  453. > 	if (type < 0)
  454.   		{
  455.   		if (dynlock_lock_callback != NULL)

crypto/lock.c:470:2: return from a call to CRYPTO_lock
  468.   		if (locking_callback != NULL)
  469.   			locking_callback(mode,type,file,line);
  470.   	}
          ^
  471.   
  472.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

crypto/x509/x509_lu.c:311:2: 
309.   
310.   	CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
311. > 	tmp=X509_OBJECT_retrieve_by_subject(ctx->objs,type,name);
312.   	CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
313.   

crypto/x509/x509_lu.c:492:1: start of procedure X509_OBJECT_retrieve_by_subject()
  490.   	}
  491.   
  492. > X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, int type,
  493.   	     X509_NAME *name)
  494.   	{

crypto/x509/x509_lu.c:496:2: 
  494.   	{
  495.   	int idx;
  496. > 	idx = X509_OBJECT_idx_by_subject(h, type, name);
  497.   	if (idx==-1) return NULL;
  498.   	return sk_X509_OBJECT_value(h, idx);

crypto/x509/x509_lu.c:486:1: start of procedure X509_OBJECT_idx_by_subject()
    484.   
    485.   
    486. > int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type,
    487.   	     X509_NAME *name)
    488.   	{

crypto/x509/x509_lu.c:489:2: Skipping x509_object_idx_cnt(): empty list of specs
    487.   	     X509_NAME *name)
    488.   	{
    489.   	return x509_object_idx_cnt(h, type, name, NULL);
            ^
    490.   	}
    491.   

crypto/x509/x509_lu.c:490:2: return from a call to X509_OBJECT_idx_by_subject
    488.   	{
    489.   	return x509_object_idx_cnt(h, type, name, NULL);
    490.   	}
            ^
    491.   
    492.   X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, int type,

crypto/x509/x509_lu.c:497:6: Taking false branch
  495.   	int idx;
  496.   	idx = X509_OBJECT_idx_by_subject(h, type, name);
  497.   	if (idx==-1) return NULL;
              ^
  498.   	return sk_X509_OBJECT_value(h, idx);
  499.   	}

crypto/x509/x509_lu.c:498:9: Condition is true
  496.   	idx = X509_OBJECT_idx_by_subject(h, type, name);
  497.   	if (idx==-1) return NULL;
  498.   	return sk_X509_OBJECT_value(h, idx);
                 ^
  499.   	}
  500.   

crypto/x509/x509_lu.c:498:2: 
  496.   	idx = X509_OBJECT_idx_by_subject(h, type, name);
  497.   	if (idx==-1) return NULL;
  498. > 	return sk_X509_OBJECT_value(h, idx);
  499.   	}
  500.   

crypto/stack/stack.c:300:1: start of procedure sk_value()
    298.   }
    299.   
    300. > void *sk_value(const _STACK *st, int i)
    301.   {
    302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;

crypto/stack/stack.c:302:6: Taking false branch
    300.   void *sk_value(const _STACK *st, int i)
    301.   {
    302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                ^
    303.   	return st->data[i];
    304.   }

crypto/stack/stack.c:302:13: Taking false branch
    300.   void *sk_value(const _STACK *st, int i)
    301.   {
    302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                       ^
    303.   	return st->data[i];
    304.   }

crypto/stack/stack.c:302:24: Taking false branch
    300.   void *sk_value(const _STACK *st, int i)
    301.   {
    302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                                  ^
    303.   	return st->data[i];
    304.   }

crypto/stack/stack.c:303:2: 
    301.   {
    302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
    303. > 	return st->data[i];
    304.   }
    305.   

crypto/stack/stack.c:304:1: return from a call to sk_value
    302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
    303.   	return st->data[i];
    304. > }
    305.   
    306.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x509_lu.c:499:2: return from a call to X509_OBJECT_retrieve_by_subject
  497.   	if (idx==-1) return NULL;
  498.   	return sk_X509_OBJECT_value(h, idx);
  499.   	}
          ^
  500.   
  501.   STACK_OF(X509)* X509_STORE_get1_certs(X509_STORE_CTX *ctx, X509_NAME *nm)

crypto/x509/x509_lu.c:312:2: 
310.   	CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
311.   	tmp=X509_OBJECT_retrieve_by_subject(ctx->objs,type,name);
312. > 	CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
313.   
314.   	if (tmp == NULL || type == X509_LU_CRL)

crypto/lock.c:426:1: start of procedure CRYPTO_lock()
  424.   	}
  425.   
  426. > void CRYPTO_lock(int mode, int type, const char *file, int line)
  427.   	{
  428.   #ifdef LOCK_DEBUG

crypto/lock.c:453:6: Taking false branch
  451.   		}
  452.   #endif
  453.   	if (type < 0)
              ^
  454.   		{
  455.   		if (dynlock_lock_callback != NULL)

crypto/lock.c:468:7: Taking true branch
  466.   		}
  467.   	else
  468.   		if (locking_callback != NULL)
               ^
  469.   			locking_callback(mode,type,file,line);
  470.   	}

crypto/lock.c:469:4: Skipping __function_pointer__(): unresolved function pointer
  467.   	else
  468.   		if (locking_callback != NULL)
  469.   			locking_callback(mode,type,file,line);
            ^
  470.   	}
  471.   

crypto/lock.c:453:2: 
  451.   		}
  452.   #endif
  453. > 	if (type < 0)
  454.   		{
  455.   		if (dynlock_lock_callback != NULL)

crypto/lock.c:470:2: return from a call to CRYPTO_lock
  468.   		if (locking_callback != NULL)
  469.   			locking_callback(mode,type,file,line);
  470.   	}
          ^
  471.   
  472.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

crypto/x509/x509_lu.c:314:6: Taking false branch
312.   	CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
313.   
314.   	if (tmp == NULL || type == X509_LU_CRL)
            ^
315.   		{
316.   		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)

crypto/x509/x509_lu.c:314:21: Taking true branch
312.   	CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
313.   
314.   	if (tmp == NULL || type == X509_LU_CRL)
                           ^
315.   		{
316.   		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)

crypto/x509/x509_lu.c:316:8: 
314.   	if (tmp == NULL || type == X509_LU_CRL)
315.   		{
316. > 		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
317.   			{
318.   			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);

crypto/x509/x509_lu.c:316:32: Condition is true
314.   	if (tmp == NULL || type == X509_LU_CRL)
315.   		{
316.   		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
                                      ^
317.   			{
318.   			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);

crypto/x509/x509_lu.c:316:30: 
314.   	if (tmp == NULL || type == X509_LU_CRL)
315.   		{
316. > 		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
317.   			{
318.   			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);

crypto/stack/stack.c:294:1: start of procedure sk_num()
  292.   	}
  293.   
  294. > int sk_num(const _STACK *st)
  295.   {
  296.   	if(st == NULL) return -1;

crypto/stack/stack.c:296:5: Taking false branch
  294.   int sk_num(const _STACK *st)
  295.   {
  296.   	if(st == NULL) return -1;
             ^
  297.   	return st->num;
  298.   }

crypto/stack/stack.c:297:2: 
  295.   {
  296.   	if(st == NULL) return -1;
  297. > 	return st->num;
  298.   }
  299.   

crypto/stack/stack.c:298:1: return from a call to sk_num
  296.   	if(st == NULL) return -1;
  297.   	return st->num;
  298. > }
  299.   
  300.   void *sk_value(const _STACK *st, int i)

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

crypto/x509/x509_lu.c:318:7: Condition is true
316.   		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
317.   			{
318.   			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);
             ^
319.   			j=X509_LOOKUP_by_subject(lu,type,name,&stmp);
320.   			if (j < 0)

crypto/x509/x509_lu.c:318:4: 
316.   		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
317.   			{
318. > 			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);
319.   			j=X509_LOOKUP_by_subject(lu,type,name,&stmp);
320.   			if (j < 0)

crypto/stack/stack.c:300:1: start of procedure sk_value()
  298.   }
  299.   
  300. > void *sk_value(const _STACK *st, int i)
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;

crypto/stack/stack.c:302:6: Taking false branch
  300.   void *sk_value(const _STACK *st, int i)
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
              ^
  303.   	return st->data[i];
  304.   }

crypto/stack/stack.c:302:13: Taking true branch
  300.   void *sk_value(const _STACK *st, int i)
  301.   {
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                     ^
  303.   	return st->data[i];
  304.   }

crypto/stack/stack.c:302:39: 
  300.   void *sk_value(const _STACK *st, int i)
  301.   {
  302. > 	if(!st || (i < 0) || (i >= st->num)) return NULL;
  303.   	return st->data[i];
  304.   }

crypto/stack/stack.c:304:1: return from a call to sk_value
  302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
  303.   	return st->data[i];
  304. > }
  305.   
  306.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x509_lu.c:319:4: 
317.   			{
318.   			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);
319. > 			j=X509_LOOKUP_by_subject(lu,type,name,&stmp);
320.   			if (j < 0)
321.   				{

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;
