crypto/x509/x509_lu.c:306: error: NULL_DEREFERENCE
  pointer `lu` last assigned on line 305 could be null and is dereferenced by call to `X509_LOOKUP_by_subject()` at line 306, column 6.
Showing all 52 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. > 	CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
298.   	tmp=X509_OBJECT_retrieve_by_subject(ctx->objs,type,name);
299.   	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:298:2: 
296.   
297.   	CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
298. > 	tmp=X509_OBJECT_retrieve_by_subject(ctx->objs,type,name);
299.   	CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
300.   

crypto/x509/x509_lu.c:479:1: start of procedure X509_OBJECT_retrieve_by_subject()
  477.   	}
  478.   
  479. > X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, int type,
  480.   	     X509_NAME *name)
  481.   	{

crypto/x509/x509_lu.c:483:2: 
  481.   	{
  482.   	int idx;
  483. > 	idx = X509_OBJECT_idx_by_subject(h, type, name);
  484.   	if (idx==-1) return NULL;
  485.   	return sk_X509_OBJECT_value(h, idx);

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

crypto/x509/x509_lu.c:476:2: Skipping x509_object_idx_cnt(): empty list of specs
    474.   	     X509_NAME *name)
    475.   	{
    476.   	return x509_object_idx_cnt(h, type, name, NULL);
            ^
    477.   	}
    478.   

crypto/x509/x509_lu.c:477:2: return from a call to X509_OBJECT_idx_by_subject
    475.   	{
    476.   	return x509_object_idx_cnt(h, type, name, NULL);
    477.   	}
            ^
    478.   
    479.   X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h, int type,

crypto/x509/x509_lu.c:484:6: Taking false branch
  482.   	int idx;
  483.   	idx = X509_OBJECT_idx_by_subject(h, type, name);
  484.   	if (idx==-1) return NULL;
              ^
  485.   	return sk_X509_OBJECT_value(h, idx);
  486.   	}

crypto/x509/x509_lu.c:485:9: Condition is true
  483.   	idx = X509_OBJECT_idx_by_subject(h, type, name);
  484.   	if (idx==-1) return NULL;
  485.   	return sk_X509_OBJECT_value(h, idx);
                 ^
  486.   	}
  487.   

crypto/x509/x509_lu.c:485:2: 
  483.   	idx = X509_OBJECT_idx_by_subject(h, type, name);
  484.   	if (idx==-1) return NULL;
  485. > 	return sk_X509_OBJECT_value(h, idx);
  486.   	}
  487.   

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:486:2: return from a call to X509_OBJECT_retrieve_by_subject
  484.   	if (idx==-1) return NULL;
  485.   	return sk_X509_OBJECT_value(h, idx);
  486.   	}
          ^
  487.   
  488.   STACK_OF(X509)* X509_STORE_get1_certs(X509_STORE_CTX *ctx, X509_NAME *nm)

crypto/x509/x509_lu.c:299:2: 
297.   	CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
298.   	tmp=X509_OBJECT_retrieve_by_subject(ctx->objs,type,name);
299. > 	CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
300.   
301.   	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:301:6: Taking false branch
299.   	CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
300.   
301.   	if (tmp == NULL || type == X509_LU_CRL)
            ^
302.   		{
303.   		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)

crypto/x509/x509_lu.c:301:21: Taking true branch
299.   	CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
300.   
301.   	if (tmp == NULL || type == X509_LU_CRL)
                           ^
302.   		{
303.   		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)

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

crypto/x509/x509_lu.c:303:32: Condition is true
301.   	if (tmp == NULL || type == X509_LU_CRL)
302.   		{
303.   		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
                                      ^
304.   			{
305.   			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);

crypto/x509/x509_lu.c:303:30: 
301.   	if (tmp == NULL || type == X509_LU_CRL)
302.   		{
303. > 		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
304.   			{
305.   			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:303:30: Loop condition is true. Entering loop body
301.   	if (tmp == NULL || type == X509_LU_CRL)
302.   		{
303.   		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
                                    ^
304.   			{
305.   			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);

crypto/x509/x509_lu.c:305:7: Condition is true
303.   		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
304.   			{
305.   			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);
             ^
306.   			j=X509_LOOKUP_by_subject(lu,type,name,&stmp);
307.   			if (j < 0)

crypto/x509/x509_lu.c:305:4: 
303.   		for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
304.   			{
305. > 			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);
306.   			j=X509_LOOKUP_by_subject(lu,type,name,&stmp);
307.   			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:306:4: 
304.   			{
305.   			lu=sk_X509_LOOKUP_value(ctx->get_cert_methods,i);
306. > 			j=X509_LOOKUP_by_subject(lu,type,name,&stmp);
307.   			if (j < 0)
308.   				{

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;
