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


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

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

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

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

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

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

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

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

crypto/cryptlib.c:440:1: start of procedure CRYPTO_lock()
  438.   	}
  439.   
  440. > void CRYPTO_lock(int mode, int type, const char *file, int line)
  441.   	{
  442.   #ifdef LOCK_DEBUG

crypto/cryptlib.c:465:6: Taking false branch
  463.   		}
  464.   #endif
  465.   	if (type < 0)
              ^
  466.   		{
  467.   		struct CRYPTO_dynlock_value *pointer

crypto/cryptlib.c:478:7: Taking true branch
  476.   		}
  477.   	else
  478.   		if (locking_callback != NULL)
               ^
  479.   			locking_callback(mode,type,file,line);
  480.   	}

crypto/cryptlib.c:479:4: Skipping __function_pointer__(): unresolved function pointer
  477.   	else
  478.   		if (locking_callback != NULL)
  479.   			locking_callback(mode,type,file,line);
            ^
  480.   	}
  481.   

crypto/cryptlib.c:465:2: 
  463.   		}
  464.   #endif
  465. > 	if (type < 0)
  466.   		{
  467.   		struct CRYPTO_dynlock_value *pointer

crypto/cryptlib.c:480:2: return from a call to CRYPTO_lock
  478.   		if (locking_callback != NULL)
  479.   			locking_callback(mode,type,file,line);
  480.   	}
          ^
  481.   
  482.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

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

engines/e_ncipher.c:866:4: 
864.   			CRYPTO_w_lock(CRYPTO_LOCK_EVP_PKEY);
865.   			rsa = res->pkey.rsa;
866. > 			res->pkey.rsa = RSA_new();
867.   			res->pkey.rsa->n = rsa->n;
868.   			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:867:4: 
865.   			rsa = res->pkey.rsa;
866.   			res->pkey.rsa = RSA_new();
867. > 			res->pkey.rsa->n = rsa->n;
868.   			res->pkey.rsa->e = rsa->e;
869.   			rsa->n = NULL;
