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

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

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

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

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

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

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

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

crypto/rsa/rsa_lib.c:132:2: 
    130.   	RSA *ret;
    131.   
    132. > 	ret=(RSA *)OPENSSL_malloc(sizeof(RSA));
    133.   	if (ret == NULL)
    134.   		{

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:133:6: Taking true branch
    131.   
    132.   	ret=(RSA *)OPENSSL_malloc(sizeof(RSA));
    133.   	if (ret == NULL)
                ^
    134.   		{
    135.   		RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE);

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

crypto/err/err.c:630:1: start of procedure ERR_put_error()
      628.   /********************************************************/
      629.   
      630. > void ERR_put_error(int lib, int func, int reason, const char *file,
      631.   	     int line)
      632.   	{

crypto/err/err.c:654:2: Skipping ERR_get_state(): empty list of specs
      652.   	}
      653.   #endif
      654.   	es=ERR_get_state();
              ^
      655.   
      656.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:656:2: 
      654.   	es=ERR_get_state();
      655.   
      656. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
      657.   	if (es->top == es->bottom)
      658.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:657:6: Taking false branch
      655.   
      656.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
      657.   	if (es->top == es->bottom)
                  ^
      658.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      659.   	es->err_flags[es->top]=0;

crypto/err/err.c:659:2: 
      657.   	if (es->top == es->bottom)
      658.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      659. > 	es->err_flags[es->top]=0;
      660.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      661.   	es->err_file[es->top]=file;

crypto/err/err.c:660:2: 
      658.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      659.   	es->err_flags[es->top]=0;
      660. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      661.   	es->err_file[es->top]=file;
      662.   	es->err_line[es->top]=line;

crypto/err/err.c:661:2: 
      659.   	es->err_flags[es->top]=0;
      660.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      661. > 	es->err_file[es->top]=file;
      662.   	es->err_line[es->top]=line;
      663.   	err_clear_data(es,es->top);

crypto/err/err.c:662:2: 
      660.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      661.   	es->err_file[es->top]=file;
      662. > 	es->err_line[es->top]=line;
      663.   	err_clear_data(es,es->top);
      664.   	}

crypto/err/err.c:663:2: Taking true branch
      661.   	es->err_file[es->top]=file;
      662.   	es->err_line[es->top]=line;
      663.   	err_clear_data(es,es->top);
              ^
      664.   	}
      665.   

crypto/err/err.c:663:2: Taking false branch
      661.   	es->err_file[es->top]=file;
      662.   	es->err_line[es->top]=line;
      663.   	err_clear_data(es,es->top);
              ^
      664.   	}
      665.   

crypto/err/err.c:663:2: Loop condition is false. Leaving loop
      661.   	es->err_file[es->top]=file;
      662.   	es->err_line[es->top]=line;
      663.   	err_clear_data(es,es->top);
              ^
      664.   	}
      665.   

crypto/err/err.c:664:2: return from a call to ERR_put_error
      662.   	es->err_line[es->top]=line;
      663.   	err_clear_data(es,es->top);
      664.   	}
              ^
      665.   
      666.   void ERR_clear_error(void)

crypto/rsa/rsa_lib.c:136:3: 
    134.   		{
    135.   		RSAerr(RSA_F_RSA_NEW_METHOD,ERR_R_MALLOC_FAILURE);
    136. > 		return NULL;
    137.   		}
    138.   

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

crypto/rsa/rsa_lib.c:78:2: 
  76.   	RSA *r=RSA_new_method(NULL);
  77.   
  78. > 	return r;
  79.   	}
  80.   

crypto/rsa/rsa_lib.c:79:2: return from a call to RSA_new
  77.   
  78.   	return r;
  79.   	}
         ^
  80.   
  81.   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;
