engines/ccgost/gost_pmeth.c:282: error: NULL_DEREFERENCE
  pointer `ec` last assigned on line 276 could be null and is dereferenced by call to `gost2001_keygen()` at line 282, column 2.
Showing all 41 steps of the trace


engines/ccgost/gost_pmeth.c:266:1: start of procedure pkey_gost01cp_keygen()
264.   
265.   /* Generates GOST_R3410 2001 key and assigns it using specified type */
266. > static int pkey_gost01cp_keygen (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
267.   	{
268.   	struct gost_pmeth_data *data = EVP_PKEY_CTX_get_data(ctx);

engines/ccgost/gost_pmeth.c:268:2: 
266.   static int pkey_gost01cp_keygen (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
267.   	{
268. > 	struct gost_pmeth_data *data = EVP_PKEY_CTX_get_data(ctx);
269.   	EC_KEY *ec=NULL;
270.   	if (data->sign_param_nid == NID_undef)

crypto/evp/pmeth_lib.c:383:1: start of procedure EVP_PKEY_CTX_get_data()
  381.   	}
  382.   
  383. > void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx)
  384.   	{
  385.   	return ctx->data;

crypto/evp/pmeth_lib.c:385:2: 
  383.   void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx)
  384.   	{
  385. > 	return ctx->data;
  386.   	}
  387.   

crypto/evp/pmeth_lib.c:386:2: return from a call to EVP_PKEY_CTX_get_data
  384.   	{
  385.   	return ctx->data;
  386.   	}
          ^
  387.   
  388.   EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx)

engines/ccgost/gost_pmeth.c:269:2: 
267.   	{
268.   	struct gost_pmeth_data *data = EVP_PKEY_CTX_get_data(ctx);
269. > 	EC_KEY *ec=NULL;
270.   	if (data->sign_param_nid == NID_undef)
271.   		{

engines/ccgost/gost_pmeth.c:270:6: Taking false branch
268.   	struct gost_pmeth_data *data = EVP_PKEY_CTX_get_data(ctx);
269.   	EC_KEY *ec=NULL;
270.   	if (data->sign_param_nid == NID_undef)
            ^
271.   		{
272.   			GOSTerr(GOST_F_PKEY_GOST01_KEYGEN,

engines/ccgost/gost_pmeth.c:276:2: 
274.   			return 0;
275.   		}
276. > 	ec = EC_KEY_new();
277.   	if (!fill_GOST2001_params(ec,data->sign_param_nid))
278.   		{

crypto/ec/ec_key.c:69:1: start of procedure EC_KEY_new()
  67.   #include <string.h>
  68.   
  69. > EC_KEY *EC_KEY_new(void)
  70.   	{
  71.   	EC_KEY *ret;

crypto/ec/ec_key.c:73:2: 
  71.   	EC_KEY *ret;
  72.   
  73. > 	ret=(EC_KEY *)OPENSSL_malloc(sizeof(EC_KEY));
  74.   	if (ret == NULL)
  75.   		{

crypto/mem.c:294:1: start of procedure CRYPTO_malloc()
    292.   	}
    293.   
    294. > void *CRYPTO_malloc(int num, const char *file, int line)
    295.   	{
    296.   	void *ret = NULL;

crypto/mem.c:296:2: 
    294.   void *CRYPTO_malloc(int num, const char *file, int line)
    295.   	{
    296. > 	void *ret = NULL;
    297.   
    298.   	if (num <= 0) return NULL;

crypto/mem.c:298:6: Taking false branch
    296.   	void *ret = NULL;
    297.   
    298.   	if (num <= 0) return NULL;
                ^
    299.   
    300.   	allow_customize = 0;

crypto/mem.c:300:2: 
    298.   	if (num <= 0) return NULL;
    299.   
    300. > 	allow_customize = 0;
    301.   	if (malloc_debug_func != NULL)
    302.   		{

crypto/mem.c:301:6: Taking true branch
    299.   
    300.   	allow_customize = 0;
    301.   	if (malloc_debug_func != NULL)
                ^
    302.   		{
    303.   		allow_customize_debug = 0;

crypto/mem.c:303:3: 
    301.   	if (malloc_debug_func != NULL)
    302.   		{
    303. > 		allow_customize_debug = 0;
    304.   		malloc_debug_func(NULL, num, file, line, 0);
    305.   		}

crypto/mem.c:304:3: Skipping __function_pointer__(): unresolved function pointer
    302.   		{
    303.   		allow_customize_debug = 0;
    304.   		malloc_debug_func(NULL, num, file, line, 0);
             ^
    305.   		}
    306.   	ret = malloc_ex_func(num,file,line);

crypto/mem.c:306:2: Skipping __function_pointer__(): unresolved function pointer
    304.   		malloc_debug_func(NULL, num, file, line, 0);
    305.   		}
    306.   	ret = malloc_ex_func(num,file,line);
            ^
    307.   #ifdef LEVITTE_DEBUG_MEM
    308.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);

crypto/mem.c:310:6: Taking true branch
    308.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
    309.   #endif
    310.   	if (malloc_debug_func != NULL)
                ^
    311.   		malloc_debug_func(ret, num, file, line, 1);
    312.   

crypto/mem.c:311:3: Skipping __function_pointer__(): unresolved function pointer
    309.   #endif
    310.   	if (malloc_debug_func != NULL)
    311.   		malloc_debug_func(ret, num, file, line, 1);
             ^
    312.   
    313.   #ifndef OPENSSL_CPUID_OBJ

crypto/mem.c:317:12: Taking false branch
    315.            * sanitisation function can't be optimised out. NB: We only do
    316.            * this for >2Kb so the overhead doesn't bother us. */
    317.           if(ret && (num > 2048))
                      ^
    318.   	{	extern unsigned char cleanse_ctr;
    319.                   ((unsigned char *)ret)[0] = cleanse_ctr;

crypto/mem.c:323:2: 
    321.   #endif
    322.   
    323. > 	return ret;
    324.   	}
    325.   

crypto/mem.c:324:2: return from a call to CRYPTO_malloc
    322.   
    323.   	return ret;
    324.   	}
            ^
    325.   
    326.   void *CRYPTO_realloc(void *str, int num, const char *file, int line)

crypto/ec/ec_key.c:74:6: Taking true branch
  72.   
  73.   	ret=(EC_KEY *)OPENSSL_malloc(sizeof(EC_KEY));
  74.   	if (ret == NULL)
             ^
  75.   		{
  76.   		ECerr(EC_F_EC_KEY_NEW, ERR_R_MALLOC_FAILURE);

crypto/ec/ec_key.c:76:3: 
  74.   	if (ret == NULL)
  75.   		{
  76. > 		ECerr(EC_F_EC_KEY_NEW, ERR_R_MALLOC_FAILURE);
  77.   		return(NULL);
  78.   		}

crypto/err/err.c:680:1: start of procedure ERR_put_error()
    678.   /********************************************************/
    679.   
    680. > void ERR_put_error(int lib, int func, int reason, const char *file,
    681.   	     int line)
    682.   	{

crypto/err/err.c:704:2: Skipping ERR_get_state(): empty list of specs
    702.   	}
    703.   #endif
    704.   	es=ERR_get_state();
            ^
    705.   
    706.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:706:2: 
    704.   	es=ERR_get_state();
    705.   
    706. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    707.   	if (es->top == es->bottom)
    708.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:707:6: Taking false branch
    705.   
    706.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    707.   	if (es->top == es->bottom)
                ^
    708.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    709.   	es->err_flags[es->top]=0;

crypto/err/err.c:709:2: 
    707.   	if (es->top == es->bottom)
    708.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    709. > 	es->err_flags[es->top]=0;
    710.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    711.   	es->err_file[es->top]=file;

crypto/err/err.c:710:2: 
    708.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    709.   	es->err_flags[es->top]=0;
    710. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    711.   	es->err_file[es->top]=file;
    712.   	es->err_line[es->top]=line;

crypto/err/err.c:711:2: 
    709.   	es->err_flags[es->top]=0;
    710.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    711. > 	es->err_file[es->top]=file;
    712.   	es->err_line[es->top]=line;
    713.   	err_clear_data(es,es->top);

crypto/err/err.c:712:2: 
    710.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    711.   	es->err_file[es->top]=file;
    712. > 	es->err_line[es->top]=line;
    713.   	err_clear_data(es,es->top);
    714.   	}

crypto/err/err.c:713:2: Taking true branch
    711.   	es->err_file[es->top]=file;
    712.   	es->err_line[es->top]=line;
    713.   	err_clear_data(es,es->top);
            ^
    714.   	}
    715.   

crypto/err/err.c:713:2: Taking false branch
    711.   	es->err_file[es->top]=file;
    712.   	es->err_line[es->top]=line;
    713.   	err_clear_data(es,es->top);
            ^
    714.   	}
    715.   

crypto/err/err.c:713:2: Loop condition is false. Leaving loop
    711.   	es->err_file[es->top]=file;
    712.   	es->err_line[es->top]=line;
    713.   	err_clear_data(es,es->top);
            ^
    714.   	}
    715.   

crypto/err/err.c:714:2: return from a call to ERR_put_error
    712.   	es->err_line[es->top]=line;
    713.   	err_clear_data(es,es->top);
    714.   	}
            ^
    715.   
    716.   void ERR_clear_error(void)

crypto/ec/ec_key.c:77:3: 
  75.   		{
  76.   		ECerr(EC_F_EC_KEY_NEW, ERR_R_MALLOC_FAILURE);
  77. > 		return(NULL);
  78.   		}
  79.   

crypto/ec/ec_key.c:89:2: return from a call to EC_KEY_new
  87.   	ret->method_data = NULL;
  88.   	return(ret);
  89.   	}
         ^
  90.   
  91.   EC_KEY *EC_KEY_new_by_curve_name(int nid)

engines/ccgost/gost_pmeth.c:277:7: Taking false branch
275.   		}
276.   	ec = EC_KEY_new();
277.   	if (!fill_GOST2001_params(ec,data->sign_param_nid))
             ^
278.   		{
279.   		EC_KEY_free(ec);

engines/ccgost/gost_pmeth.c:282:2: 
280.   		return 0;
281.   		}
282. > 	gost2001_keygen(ec);
283.   
284.   	EVP_PKEY_assign(pkey,NID_id_GostR3410_2001,ec);
