crypto/bn/bn_prime.c:193: error: NULL_DEREFERENCE
  pointer `ctx` last assigned on line 169 could be null and is dereferenced at line 193, column 2.
Showing all 35 steps of the trace


crypto/bn/bn_prime.c:156:1: start of procedure BN_is_prime()
154.   	}
155.   
156. > int BN_is_prime(BIGNUM *a, int checks, void (*callback)(int,int,void *),
157.   	     BN_CTX *ctx_passed, void *cb_arg)
158.   	{

crypto/bn/bn_prime.c:159:2: 
157.   	     BN_CTX *ctx_passed, void *cb_arg)
158.   	{
159. > 	int i,j,c2=0,ret= -1;
160.   	BIGNUM *check;
161.   	BN_CTX *ctx=NULL,*ctx2=NULL;

crypto/bn/bn_prime.c:161:2: 
159.   	int i,j,c2=0,ret= -1;
160.   	BIGNUM *check;
161. > 	BN_CTX *ctx=NULL,*ctx2=NULL;
162.   	BN_MONT_CTX *mont=NULL;
163.   

crypto/bn/bn_prime.c:162:2: 
160.   	BIGNUM *check;
161.   	BN_CTX *ctx=NULL,*ctx2=NULL;
162. > 	BN_MONT_CTX *mont=NULL;
163.   
164.   	if (!BN_is_odd(a))

crypto/bn/bn_prime.c:164:7: Taking false branch
162.   	BN_MONT_CTX *mont=NULL;
163.   
164.   	if (!BN_is_odd(a))
             ^
165.   		return(0);
166.   	if (ctx_passed != NULL)

crypto/bn/bn_prime.c:164:7: Taking false branch
162.   	BN_MONT_CTX *mont=NULL;
163.   
164.   	if (!BN_is_odd(a))
             ^
165.   		return(0);
166.   	if (ctx_passed != NULL)

crypto/bn/bn_prime.c:166:6: Taking false branch
164.   	if (!BN_is_odd(a))
165.   		return(0);
166.   	if (ctx_passed != NULL)
            ^
167.   		ctx=ctx_passed;
168.   	else

crypto/bn/bn_prime.c:169:7: 
167.   		ctx=ctx_passed;
168.   	else
169. > 		if ((ctx=BN_CTX_new()) == NULL) goto err;
170.   
171.   	if ((ctx2=BN_CTX_new()) == NULL) goto err;

crypto/bn/bn_lib.c:308:1: start of procedure BN_CTX_new()
  306.   
  307.   
  308. > BN_CTX *BN_CTX_new(void)
  309.   	{
  310.   	BN_CTX *ret;

crypto/bn/bn_lib.c:312:2: 
  310.   	BN_CTX *ret;
  311.   
  312. > 	ret=(BN_CTX *)Malloc(sizeof(BN_CTX));
  313.   	if (ret == NULL)
  314.   		{

crypto/mem.c:194:1: start of procedure CRYPTO_malloc()
    192.   	}
    193.   
    194. > void *CRYPTO_malloc(int num, char *file, int line)
    195.   	{
    196.   	char *ret = NULL;

crypto/mem.c:196:2: 
    194.   void *CRYPTO_malloc(int num, char *file, int line)
    195.   	{
    196. > 	char *ret = NULL;
    197.   
    198.   	allow_customize = 0;

crypto/mem.c:198:2: 
    196.   	char *ret = NULL;
    197.   
    198. > 	allow_customize = 0;
    199.   	if (malloc_debug_func != NULL)
    200.   		{

crypto/mem.c:199:6: Taking false branch
    197.   
    198.   	allow_customize = 0;
    199.   	if (malloc_debug_func != NULL)
                ^
    200.   		{
    201.   		allow_customize_debug = 0;

crypto/mem.c:204:2: Skipping __function_pointer__(): unresolved function pointer
    202.   		malloc_debug_func(NULL, num, file, line, 0);
    203.   		}
    204.   	ret = malloc_func(num);
            ^
    205.   #ifdef LEVITTE_DEBUG
    206.   	fprintf(stderr, "LEVITTE_DEBUG:         > 0x%p (%d)\n", ret, num);

crypto/mem.c:208:6: Taking false branch
    206.   	fprintf(stderr, "LEVITTE_DEBUG:         > 0x%p (%d)\n", ret, num);
    207.   #endif
    208.   	if (malloc_debug_func != NULL)
                ^
    209.   		malloc_debug_func(ret, num, file, line, 1);
    210.   

crypto/mem.c:211:2: 
    209.   		malloc_debug_func(ret, num, file, line, 1);
    210.   
    211. > 	return ret;
    212.   	}
    213.   

crypto/mem.c:212:2: return from a call to CRYPTO_malloc
    210.   
    211.   	return ret;
    212.   	}
            ^
    213.   
    214.   void *CRYPTO_realloc(void *str, int num, char *file, int line)

crypto/bn/bn_lib.c:313:6: Taking true branch
  311.   
  312.   	ret=(BN_CTX *)Malloc(sizeof(BN_CTX));
  313.   	if (ret == NULL)
              ^
  314.   		{
  315.   		BNerr(BN_F_BN_CTX_NEW,ERR_R_MALLOC_FAILURE);

crypto/bn/bn_lib.c:315:3: 
  313.   	if (ret == NULL)
  314.   		{
  315. > 		BNerr(BN_F_BN_CTX_NEW,ERR_R_MALLOC_FAILURE);
  316.   		return(NULL);
  317.   		}

crypto/err/err.c:246:1: start of procedure ERR_put_error()
    244.   /********************************************************/
    245.   
    246. > void ERR_put_error(int lib, int func, int reason, const char *file,
    247.   	     int line)
    248.   	{

crypto/err/err.c:270:2: Skipping ERR_get_state(): empty list of specs
    268.   	}
    269.   #endif
    270.   	es=ERR_get_state();
            ^
    271.   
    272.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:272:2: 
    270.   	es=ERR_get_state();
    271.   
    272. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    273.   	if (es->top == es->bottom)
    274.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:273:6: Taking false branch
    271.   
    272.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    273.   	if (es->top == es->bottom)
                ^
    274.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    275.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:275:2: 
    273.   	if (es->top == es->bottom)
    274.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    275. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    276.   	es->err_file[es->top]=file;
    277.   	es->err_line[es->top]=line;

crypto/err/err.c:276:2: 
    274.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    275.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    276. > 	es->err_file[es->top]=file;
    277.   	es->err_line[es->top]=line;
    278.   	err_clear_data(es,es->top);

crypto/err/err.c:277:2: 
    275.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    276.   	es->err_file[es->top]=file;
    277. > 	es->err_line[es->top]=line;
    278.   	err_clear_data(es,es->top);
    279.   	}

crypto/err/err.c:278:2: Taking true branch
    276.   	es->err_file[es->top]=file;
    277.   	es->err_line[es->top]=line;
    278.   	err_clear_data(es,es->top);
            ^
    279.   	}
    280.   

crypto/err/err.c:278:2: Taking false branch
    276.   	es->err_file[es->top]=file;
    277.   	es->err_line[es->top]=line;
    278.   	err_clear_data(es,es->top);
            ^
    279.   	}
    280.   

crypto/err/err.c:279:2: return from a call to ERR_put_error
    277.   	es->err_line[es->top]=line;
    278.   	err_clear_data(es,es->top);
    279.   	}
            ^
    280.   
    281.   void ERR_clear_error(void)

crypto/bn/bn_lib.c:316:3: 
  314.   		{
  315.   		BNerr(BN_F_BN_CTX_NEW,ERR_R_MALLOC_FAILURE);
  316. > 		return(NULL);
  317.   		}
  318.   

crypto/bn/bn_lib.c:322:2: return from a call to BN_CTX_new
  320.   	ret->flags=BN_FLG_MALLOCED;
  321.   	return(ret);
  322.   	}
          ^
  323.   
  324.   void BN_CTX_init(BN_CTX *ctx)

crypto/bn/bn_prime.c:169:7: Taking true branch
167.   		ctx=ctx_passed;
168.   	else
169.   		if ((ctx=BN_CTX_new()) == NULL) goto err;
             ^
170.   
171.   	if ((ctx2=BN_CTX_new()) == NULL) goto err;

crypto/bn/bn_prime.c:192:1: 
190.   		}
191.   	ret=1;
192. > err:
193.   	ctx->tos--;
194.   	if ((ctx_passed == NULL) && (ctx != NULL))

crypto/bn/bn_prime.c:193:2: 
191.   	ret=1;
192.   err:
193. > 	ctx->tos--;
194.   	if ((ctx_passed == NULL) && (ctx != NULL))
195.   		BN_CTX_free(ctx);
