crypto/x509/x509_lu.c:583: error: NULL_DEREFERENCE
  pointer `obj` last assigned on line 582 could be null and is dereferenced at line 583, column 7.
Showing all 47 steps of the trace


crypto/x509/x509_lu.c:551:1: start of procedure X509_STORE_get1_crls()
549.   	}
550.   
551. > STACK_OF(X509_CRL) *X509_STORE_get1_crls(X509_STORE_CTX *ctx, X509_NAME *nm)
552.   	{
553.   	int i, idx, cnt;

crypto/x509/x509_lu.c:557:2: 
555.   	X509_CRL *x;
556.   	X509_OBJECT *obj, xobj;
557. > 	sk = sk_X509_CRL_new_null();
558.   	CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
559.   	/* Check cache first */

crypto/stack/stack.c:153:1: start of procedure sk_new_null()
  151.   	}
  152.   
  153. > _STACK *sk_new_null(void)
  154.   	{
  155.   	return sk_new((int (*)(const void *, const void *))0);

crypto/stack/stack.c:155:2: Skipping sk_new(): empty list of specs
  153.   _STACK *sk_new_null(void)
  154.   	{
  155.   	return sk_new((int (*)(const void *, const void *))0);
          ^
  156.   	}
  157.   

crypto/stack/stack.c:156:2: return from a call to sk_new_null
  154.   	{
  155.   	return sk_new((int (*)(const void *, const void *))0);
  156.   	}
          ^
  157.   
  158.   _STACK *sk_new(int (*c)(const void *, const void *))

crypto/x509/x509_lu.c:558:2: 
556.   	X509_OBJECT *obj, xobj;
557.   	sk = sk_X509_CRL_new_null();
558. > 	CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
559.   	/* Check cache first */
560.   	idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_CRL, nm, &cnt);

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

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

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

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

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

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

crypto/x509/x509_lu.c:560:2: Skipping x509_object_idx_cnt(): empty list of specs
558.   	CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
559.   	/* Check cache first */
560.   	idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_CRL, nm, &cnt);
        ^
561.   
562.   	/* Always do lookup to possibly add new CRLs to cache

crypto/x509/x509_lu.c:564:2: 
562.   	/* Always do lookup to possibly add new CRLs to cache
563.   	 */
564. > 	CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
565.   	if (!X509_STORE_get_by_subject(ctx, X509_LU_CRL, nm, &xobj))
566.   		{

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

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

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

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

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

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

crypto/x509/x509_lu.c:565:7: Taking false branch
563.   	 */
564.   	CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
565.   	if (!X509_STORE_get_by_subject(ctx, X509_LU_CRL, nm, &xobj))
             ^
566.   		{
567.   		sk_X509_CRL_free(sk);

crypto/x509/x509_lu.c:570:2: 
568.   		return NULL;
569.   		}
570. > 	X509_OBJECT_free_contents(&xobj);
571.   	CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
572.   	idx = x509_object_idx_cnt(ctx->ctx->objs,X509_LU_CRL, nm, &cnt);

crypto/x509/x509_lu.c:427:1: start of procedure X509_OBJECT_free_contents()
  425.   	}
  426.   
  427. > void X509_OBJECT_free_contents(X509_OBJECT *a)
  428.   	{
  429.   	switch (a->type)

crypto/x509/x509_lu.c:429:2: 
  427.   void X509_OBJECT_free_contents(X509_OBJECT *a)
  428.   	{
  429. > 	switch (a->type)
  430.   		{
  431.   	case X509_LU_X509:

crypto/x509/x509_lu.c:431:2: Switch condition is false. Skipping switch case
  429.   	switch (a->type)
  430.   		{
  431.   	case X509_LU_X509:
          ^
  432.   		X509_free(a->data.x509);
  433.   		break;

crypto/x509/x509_lu.c:434:2: Switch condition is false. Skipping switch case
  432.   		X509_free(a->data.x509);
  433.   		break;
  434.   	case X509_LU_CRL:
          ^
  435.   		X509_CRL_free(a->data.crl);
  436.   		break;

crypto/x509/x509_lu.c:438:2: return from a call to X509_OBJECT_free_contents
  436.   		break;
  437.   		}
  438.   	}
          ^
  439.   
  440.   static int x509_object_idx_cnt(STACK_OF(X509_OBJECT) *h, int type,

crypto/x509/x509_lu.c:571:2: 
569.   		}
570.   	X509_OBJECT_free_contents(&xobj);
571. > 	CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
572.   	idx = x509_object_idx_cnt(ctx->ctx->objs,X509_LU_CRL, nm, &cnt);
573.   	if (idx < 0)

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

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

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

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

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

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

crypto/x509/x509_lu.c:572:2: Skipping x509_object_idx_cnt(): empty list of specs
570.   	X509_OBJECT_free_contents(&xobj);
571.   	CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
572.   	idx = x509_object_idx_cnt(ctx->ctx->objs,X509_LU_CRL, nm, &cnt);
        ^
573.   	if (idx < 0)
574.   		{

crypto/x509/x509_lu.c:573:6: Taking false branch
571.   	CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
572.   	idx = x509_object_idx_cnt(ctx->ctx->objs,X509_LU_CRL, nm, &cnt);
573.   	if (idx < 0)
            ^
574.   		{
575.   		CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);

crypto/x509/x509_lu.c:580:7: 
578.   		}
579.   
580. > 	for (i = 0; i < cnt; i++, idx++)
581.   		{
582.   		obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);

crypto/x509/x509_lu.c:580:14: Loop condition is true. Entering loop body
578.   		}
579.   
580.   	for (i = 0; i < cnt; i++, idx++)
                    ^
581.   		{
582.   		obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);

crypto/x509/x509_lu.c:582:9: Condition is true
580.   	for (i = 0; i < cnt; i++, idx++)
581.   		{
582.   		obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
               ^
583.   		x = obj->data.crl;
584.   		CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509_CRL);

crypto/x509/x509_lu.c:582:3: 
580.   	for (i = 0; i < cnt; i++, idx++)
581.   		{
582. > 		obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
583.   		x = obj->data.crl;
584.   		CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509_CRL);

crypto/stack/stack.c:338:1: start of procedure sk_value()
  336.   }
  337.   
  338. > void *sk_value(const _STACK *st, int i)
  339.   {
  340.   	if(!st || (i < 0) || (i >= st->num)) return NULL;

crypto/stack/stack.c:340:6: Taking false branch
  338.   void *sk_value(const _STACK *st, int i)
  339.   {
  340.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
              ^
  341.   	return st->data[i];
  342.   }

crypto/stack/stack.c:340:13: Taking false branch
  338.   void *sk_value(const _STACK *st, int i)
  339.   {
  340.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                     ^
  341.   	return st->data[i];
  342.   }

crypto/stack/stack.c:340:24: Taking true branch
  338.   void *sk_value(const _STACK *st, int i)
  339.   {
  340.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                                ^
  341.   	return st->data[i];
  342.   }

crypto/stack/stack.c:340:39: 
  338.   void *sk_value(const _STACK *st, int i)
  339.   {
  340. > 	if(!st || (i < 0) || (i >= st->num)) return NULL;
  341.   	return st->data[i];
  342.   }

crypto/stack/stack.c:342:1: return from a call to sk_value
  340.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
  341.   	return st->data[i];
  342. > }
  343.   
  344.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x509_lu.c:583:3: 
581.   		{
582.   		obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
583. > 		x = obj->data.crl;
584.   		CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509_CRL);
585.   		if (!sk_X509_CRL_push(sk, x))

STACK_OF(X509_CRL) *X509_STORE_get1_crls(X509_STORE_CTX *ctx, X509_NAME *nm)
	{
	int i, idx, cnt;
	STACK_OF(X509_CRL) *sk;
	X509_CRL *x;
	X509_OBJECT *obj, xobj;
	sk = sk_X509_CRL_new_null();
	CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
	idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_CRL, nm, &cnt);
	CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
	if (!X509_STORE_get_by_subject(ctx, X509_LU_CRL, nm, &xobj))
		{
		sk_X509_CRL_free(sk);
		return NULL;
		}
	X509_OBJECT_free_contents(&xobj);
	CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
	idx = x509_object_idx_cnt(ctx->ctx->objs,X509_LU_CRL, nm, &cnt);
	if (idx < 0)
		{
		CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
		sk_X509_CRL_free(sk);
		return NULL;
		}
	for (i = 0; i < cnt; i++, idx++)
		{
		obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);
		x = obj->data.crl;
		CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509_CRL);
		if (!sk_X509_CRL_push(sk, x))
			{
			CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
			X509_CRL_free(x);
			sk_X509_CRL_pop_free(sk, X509_CRL_free);
			return NULL;
			}
		}
	CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
	return sk;
	}
['STACK_OF(X509_CRL) *X509_STORE_get1_crls(X509_STORE_CTX *ctx, X509_NAME *nm)\n\t{\n\tint i, idx, cnt;\n\tSTACK_OF(X509_CRL) *sk;\n\tX509_CRL *x;\n\tX509_OBJECT *obj, xobj;\n\tsk = sk_X509_CRL_new_null();\n\tCRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);\n\tidx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_CRL, nm, &cnt);\n\tCRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);\n\tif (!X509_STORE_get_by_subject(ctx, X509_LU_CRL, nm, &xobj))\n\t\t{\n\t\tsk_X509_CRL_free(sk);\n\t\treturn NULL;\n\t\t}\n\tX509_OBJECT_free_contents(&xobj);\n\tCRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);\n\tidx = x509_object_idx_cnt(ctx->ctx->objs,X509_LU_CRL, nm, &cnt);\n\tif (idx < 0)\n\t\t{\n\t\tCRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);\n\t\tsk_X509_CRL_free(sk);\n\t\treturn NULL;\n\t\t}\n\tfor (i = 0; i < cnt; i++, idx++)\n\t\t{\n\t\tobj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);\n\t\tx = obj->data.crl;\n\t\tCRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509_CRL);\n\t\tif (!sk_X509_CRL_push(sk, x))\n\t\t\t{\n\t\t\tCRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);\n\t\t\tX509_CRL_free(x);\n\t\t\tsk_X509_CRL_pop_free(sk, X509_CRL_free);\n\t\t\treturn NULL;\n\t\t\t}\n\t\t}\n\tCRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);\n\treturn sk;\n\t}', '_STACK *sk_new_null(void)\n\t{\n\treturn sk_new((int (*)(const void *, const void *))0);\n\t}', 'void CRYPTO_lock(int mode, int type, const char *file, int line)\n\t{\n#ifdef LOCK_DEBUG\n\t\t{\n\t\tCRYPTO_THREADID id;\n\t\tchar *rw_text,*operation_text;\n\t\tif (mode & CRYPTO_LOCK)\n\t\t\toperation_text="lock  ";\n\t\telse if (mode & CRYPTO_UNLOCK)\n\t\t\toperation_text="unlock";\n\t\telse\n\t\t\toperation_text="ERROR ";\n\t\tif (mode & CRYPTO_READ)\n\t\t\trw_text="r";\n\t\telse if (mode & CRYPTO_WRITE)\n\t\t\trw_text="w";\n\t\telse\n\t\t\trw_text="ERROR";\n\t\tCRYPTO_THREADID_current(&id);\n\t\tfprintf(stderr,"lock:%08lx:(%s)%s %-18s %s:%d\\n",\n\t\t\tCRYPTO_THREADID_hash(&id), rw_text, operation_text,\n\t\t\tCRYPTO_get_lock_name(type), file, line);\n\t\t}\n#endif\n\tif (type < 0)\n\t\t{\n\t\tif (dynlock_lock_callback != NULL)\n\t\t\t{\n\t\t\tstruct CRYPTO_dynlock_value *pointer\n\t\t\t\t= CRYPTO_get_dynlock_value(type);\n\t\t\tOPENSSL_assert(pointer != NULL);\n\t\t\tdynlock_lock_callback(mode, pointer, file, line);\n\t\t\tCRYPTO_destroy_dynlockid(type);\n\t\t\t}\n\t\t}\n\telse\n\t\tif (locking_callback != NULL)\n\t\t\tlocking_callback(mode,type,file,line);\n\t}', 'void X509_OBJECT_free_contents(X509_OBJECT *a)\n\t{\n\tswitch (a->type)\n\t\t{\n\tcase X509_LU_X509:\n\t\tX509_free(a->data.x509);\n\t\tbreak;\n\tcase X509_LU_CRL:\n\t\tX509_CRL_free(a->data.crl);\n\t\tbreak;\n\t\t}\n\t}', 'void *sk_value(const _STACK *st, int i)\n{\n\tif(!st || (i < 0) || (i >= st->num)) return NULL;\n\treturn st->data[i];\n}']