engines/e_ncipher.c:869: error: NULL_DEREFERENCE
  pointer `res->pkey.rsa` last assigned on line 868 could be null and is dereferenced at line 869, column 4.
Showing all 48 steps of the trace


engines/e_ncipher.c:848:1: start of procedure hwcrhk_load_pubkey()
846.   	}
847.   
848. > static EVP_PKEY *hwcrhk_load_pubkey(ENGINE *eng, const char *key_id,
849.   	UI_METHOD *ui_method, void *callback_data)
850.   	{

engines/e_ncipher.c:851:2: 
849.   	UI_METHOD *ui_method, void *callback_data)
850.   	{
851. > 	EVP_PKEY *res = NULL;
852.   
853.   #ifndef OPENSSL_NO_RSA

engines/e_ncipher.c:854:9: Skipping hwcrhk_load_privkey(): empty list of specs
852.   
853.   #ifndef OPENSSL_NO_RSA
854.           res = hwcrhk_load_privkey(eng, key_id,
               ^
855.                   ui_method, callback_data);
856.   #endif

engines/e_ncipher.c:858:6: Taking true branch
856.   #endif
857.   
858.   	if (res)
            ^
859.   		switch(res->type)
860.   			{

engines/e_ncipher.c:859:3: 
857.   
858.   	if (res)
859. > 		switch(res->type)
860.   			{
861.   #ifndef OPENSSL_NO_RSA

engines/e_ncipher.c:862:3: Switch condition is true. Entering switch case
860.   			{
861.   #ifndef OPENSSL_NO_RSA
862.   		case EVP_PKEY_RSA:
         ^
863.   			{
864.   			RSA *rsa = NULL;

engines/e_ncipher.c:864:4: 
862.   		case EVP_PKEY_RSA:
863.   			{
864. > 			RSA *rsa = NULL;
865.   
866.   			CRYPTO_w_lock(CRYPTO_LOCK_EVP_PKEY);

engines/e_ncipher.c:866:4: 
864.   			RSA *rsa = NULL;
865.   
866. > 			CRYPTO_w_lock(CRYPTO_LOCK_EVP_PKEY);
867.   			rsa = res->pkey.rsa;
868.   			res->pkey.rsa = RSA_new();

crypto/cryptlib.c:448:1: start of procedure CRYPTO_lock()
  446.   	}
  447.   
  448. > void CRYPTO_lock(int mode, int type, const char *file, int line)
  449.   	{
  450.   #ifdef LOCK_DEBUG

crypto/cryptlib.c:473:6: Taking false branch
  471.   		}
  472.   #endif
  473.   	if (type < 0)
              ^
  474.   		{
  475.   		if (dynlock_lock_callback != NULL)

crypto/cryptlib.c:488:7: Taking true branch
  486.   		}
  487.   	else
  488.   		if (locking_callback != NULL)
               ^
  489.   			locking_callback(mode,type,file,line);
  490.   	}

crypto/cryptlib.c:489:4: Skipping __function_pointer__(): unresolved function pointer
  487.   	else
  488.   		if (locking_callback != NULL)
  489.   			locking_callback(mode,type,file,line);
            ^
  490.   	}
  491.   

crypto/cryptlib.c:473:2: 
  471.   		}
  472.   #endif
  473. > 	if (type < 0)
  474.   		{
  475.   		if (dynlock_lock_callback != NULL)

crypto/cryptlib.c:490:2: return from a call to CRYPTO_lock
  488.   		if (locking_callback != NULL)
  489.   			locking_callback(mode,type,file,line);
  490.   	}
          ^
  491.   
  492.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

engines/e_ncipher.c:867:4: 
865.   
866.   			CRYPTO_w_lock(CRYPTO_LOCK_EVP_PKEY);
867. > 			rsa = res->pkey.rsa;
868.   			res->pkey.rsa = RSA_new();
869.   			res->pkey.rsa->n = rsa->n;

engines/e_ncipher.c:868:4: 
866.   			CRYPTO_w_lock(CRYPTO_LOCK_EVP_PKEY);
867.   			rsa = res->pkey.rsa;
868. > 			res->pkey.rsa = RSA_new();
869.   			res->pkey.rsa->n = rsa->n;
870.   			res->pkey.rsa->e = rsa->e;

crypto/rsa/rsa_lib.c:71:1: start of procedure RSA_new()
  69.   static const RSA_METHOD *default_RSA_meth=NULL;
  70.   
  71. > RSA *RSA_new(void)
  72.   	{
  73.   	return(RSA_new_method(NULL));

crypto/rsa/rsa_lib.c:73:2: 
  71.   RSA *RSA_new(void)
  72.   	{
  73. > 	return(RSA_new_method(NULL));
  74.   	}
  75.   

crypto/rsa/rsa_lib.c:121:1: start of procedure RSA_new_method()
    119.   	}
    120.   
    121. > RSA *RSA_new_method(ENGINE *engine)
    122.   	{
    123.   	RSA *ret;

crypto/rsa/rsa_lib.c:125:2: 
    123.   	RSA *ret;
    124.   
    125. > 	ret=(RSA *)OPENSSL_malloc(sizeof(RSA));
    126.   	if (ret == NULL)
    127.   		{

crypto/mem.c:289:1: start of procedure CRYPTO_malloc()
      287.   	}
      288.   
      289. > void *CRYPTO_malloc(int num, const char *file, int line)
      290.   	{
      291.   	void *ret = NULL;

crypto/mem.c:291:2: 
      289.   void *CRYPTO_malloc(int num, const char *file, int line)
      290.   	{
      291. > 	void *ret = NULL;
      292.   	extern unsigned char cleanse_ctr;
      293.   

crypto/mem.c:294:2: 
      292.   	extern unsigned char cleanse_ctr;
      293.   
      294. > 	allow_customize = 0;
      295.   	if (malloc_debug_func != NULL)
      296.   		{

crypto/mem.c:295:6: Taking true branch
      293.   
      294.   	allow_customize = 0;
      295.   	if (malloc_debug_func != NULL)
                  ^
      296.   		{
      297.   		allow_customize_debug = 0;

crypto/mem.c:297:3: 
      295.   	if (malloc_debug_func != NULL)
      296.   		{
      297. > 		allow_customize_debug = 0;
      298.   		malloc_debug_func(NULL, num, file, line, 0);
      299.   		}

crypto/mem.c:298:3: Skipping __function_pointer__(): unresolved function pointer
      296.   		{
      297.   		allow_customize_debug = 0;
      298.   		malloc_debug_func(NULL, num, file, line, 0);
               ^
      299.   		}
      300.   	ret = malloc_ex_func(num,file,line);

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

crypto/mem.c:304:6: Taking true branch
      302.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
      303.   #endif
      304.   	if (malloc_debug_func != NULL)
                  ^
      305.   		malloc_debug_func(ret, num, file, line, 1);
      306.   

crypto/mem.c:305:3: Skipping __function_pointer__(): unresolved function pointer
      303.   #endif
      304.   	if (malloc_debug_func != NULL)
      305.   		malloc_debug_func(ret, num, file, line, 1);
               ^
      306.   
      307.           /* Create a dependency on the value of 'cleanse_ctr' so our memory

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

crypto/mem.c:313:2: 
      311.                   ((unsigned char *)ret)[0] = cleanse_ctr;
      312.   
      313. > 	return ret;
      314.   	}
      315.   

crypto/mem.c:314:2: return from a call to CRYPTO_malloc
      312.   
      313.   	return ret;
      314.   	}
              ^
      315.   
      316.   void *CRYPTO_realloc(void *str, int num, const char *file, int line)

crypto/rsa/rsa_lib.c:126:6: Taking true branch
    124.   
    125.   	ret=(RSA *)OPENSSL_malloc(sizeof(RSA));
    126.   	if (ret == NULL)
                ^
    127.   		{
    128.   		RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE);

crypto/rsa/rsa_lib.c:128:3: 
    126.   	if (ret == NULL)
    127.   		{
    128. > 		RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE);
    129.   		return NULL;
    130.   		}

crypto/err/err.c:617:1: start of procedure ERR_put_error()
      615.   /********************************************************/
      616.   
      617. > void ERR_put_error(int lib, int func, int reason, const char *file,
      618.   	     int line)
      619.   	{

crypto/err/err.c:641:2: Skipping ERR_get_state(): empty list of specs
      639.   	}
      640.   #endif
      641.   	es=ERR_get_state();
              ^
      642.   
      643.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:643:2: 
      641.   	es=ERR_get_state();
      642.   
      643. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
      644.   	if (es->top == es->bottom)
      645.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:644:6: Taking false branch
      642.   
      643.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
      644.   	if (es->top == es->bottom)
                  ^
      645.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      646.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:646:2: 
      644.   	if (es->top == es->bottom)
      645.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      646. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      647.   	es->err_file[es->top]=file;
      648.   	es->err_line[es->top]=line;

crypto/err/err.c:647:2: 
      645.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      646.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      647. > 	es->err_file[es->top]=file;
      648.   	es->err_line[es->top]=line;
      649.   	err_clear_data(es,es->top);

crypto/err/err.c:648:2: 
      646.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      647.   	es->err_file[es->top]=file;
      648. > 	es->err_line[es->top]=line;
      649.   	err_clear_data(es,es->top);
      650.   	}

crypto/err/err.c:649:2: Taking true branch
      647.   	es->err_file[es->top]=file;
      648.   	es->err_line[es->top]=line;
      649.   	err_clear_data(es,es->top);
              ^
      650.   	}
      651.   

crypto/err/err.c:649:2: Taking false branch
      647.   	es->err_file[es->top]=file;
      648.   	es->err_line[es->top]=line;
      649.   	err_clear_data(es,es->top);
              ^
      650.   	}
      651.   

crypto/err/err.c:650:2: return from a call to ERR_put_error
      648.   	es->err_line[es->top]=line;
      649.   	err_clear_data(es,es->top);
      650.   	}
              ^
      651.   
      652.   void ERR_clear_error(void)

crypto/rsa/rsa_lib.c:129:3: 
    127.   		{
    128.   		RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE);
    129. > 		return NULL;
    130.   		}
    131.   

crypto/rsa/rsa_lib.c:185:2: return from a call to RSA_new_method
    183.   		}
    184.   	return(ret);
    185.   	}
            ^
    186.   
    187.   void RSA_free(RSA *r)

crypto/rsa/rsa_lib.c:74:2: return from a call to RSA_new
  72.   	{
  73.   	return(RSA_new_method(NULL));
  74.   	}
         ^
  75.   
  76.   void RSA_set_default_method(const RSA_METHOD *meth)

engines/e_ncipher.c:869:4: 
867.   			rsa = res->pkey.rsa;
868.   			res->pkey.rsa = RSA_new();
869. > 			res->pkey.rsa->n = rsa->n;
870.   			res->pkey.rsa->e = rsa->e;
871.   			rsa->n = NULL;
