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 49 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:449:1: start of procedure CRYPTO_lock()
  447.   	}
  448.   
  449. > void CRYPTO_lock(int mode, int type, const char *file, int line)
  450.   	{
  451.   #ifdef LOCK_DEBUG

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

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

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

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

crypto/cryptlib.c:491:2: return from a call to CRYPTO_lock
  489.   		if (locking_callback != NULL)
  490.   			locking_callback(mode,type,file,line);
  491.   	}
          ^
  492.   
  493.   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:73:1: start of procedure RSA_new()
  71.   static const RSA_METHOD *default_RSA_meth=NULL;
  72.   
  73. > RSA *RSA_new(void)
  74.   	{
  75.   	return(RSA_new_method(NULL));

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

crypto/rsa/rsa_lib.c:125:1: start of procedure RSA_new_method()
    123.   	}
    124.   
    125. > RSA *RSA_new_method(ENGINE *engine)
    126.   	{
    127.   	RSA *ret;

crypto/rsa/rsa_lib.c:129:2: 
    127.   	RSA *ret;
    128.   
    129. > 	ret=(RSA *)OPENSSL_malloc(sizeof(RSA));
    130.   	if (ret == NULL)
    131.   		{

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

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

crypto/mem.c:296:6: Taking false branch
      294.   	extern unsigned char cleanse_ctr;
      295.   
      296.   	if (num < 0) return NULL;
                  ^
      297.   
      298.   	allow_customize = 0;

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

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

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

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

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

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

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

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

crypto/mem.c:317:2: 
      315.                   ((unsigned char *)ret)[0] = cleanse_ctr;
      316.   
      317. > 	return ret;
      318.   	}
      319.   

crypto/mem.c:318:2: return from a call to CRYPTO_malloc
      316.   
      317.   	return ret;
      318.   	}
              ^
      319.   
      320.   void *CRYPTO_realloc(void *str, int num, const char *file, int line)

crypto/rsa/rsa_lib.c:130:6: Taking true branch
    128.   
    129.   	ret=(RSA *)OPENSSL_malloc(sizeof(RSA));
    130.   	if (ret == NULL)
                ^
    131.   		{
    132.   		RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE);

crypto/rsa/rsa_lib.c:132:3: 
    130.   	if (ret == NULL)
    131.   		{
    132. > 		RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE);
    133.   		return NULL;
    134.   		}

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

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

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

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

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

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

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

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

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

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

crypto/rsa/rsa_lib.c:133:3: 
    131.   		{
    132.   		RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE);
    133. > 		return NULL;
    134.   		}
    135.   

crypto/rsa/rsa_lib.c:193:2: return from a call to RSA_new_method
    191.   		}
    192.   	return(ret);
    193.   	}
            ^
    194.   
    195.   void RSA_free(RSA *r)

crypto/rsa/rsa_lib.c:76:2: return from a call to RSA_new
  74.   	{
  75.   	return(RSA_new_method(NULL));
  76.   	}
         ^
  77.   
  78.   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;
