engines/e_ncipher.c:798: error: NULL_DEREFERENCE
  pointer `rtmp` last assigned on line 797 could be null and is dereferenced by call to `RSA_set_ex_data()` at line 798, column 2.
Showing all 59 steps of the trace


engines/e_ncipher.c:743:1: start of procedure hwcrhk_load_privkey()
741.   	}
742.   
743. > static EVP_PKEY *hwcrhk_load_privkey(ENGINE *eng, const char *key_id,
744.   	UI_METHOD *ui_method, void *callback_data)
745.   	{

engines/e_ncipher.c:747:2: 
745.   	{
746.   #ifndef OPENSSL_NO_RSA
747. > 	RSA *rtmp = NULL;
748.   #endif
749.   	EVP_PKEY *res = NULL;

engines/e_ncipher.c:749:2: 
747.   	RSA *rtmp = NULL;
748.   #endif
749. > 	EVP_PKEY *res = NULL;
750.   #ifndef OPENSSL_NO_RSA
751.   	HWCryptoHook_MPI e, n;

engines/e_ncipher.c:761:2: 
759.   
760.   #if !defined(OPENSSL_NO_RSA)
761. > 	rmsg.buf = tempbuf;
762.   	rmsg.size = sizeof(tempbuf);
763.   #endif

engines/e_ncipher.c:762:2: 
760.   #if !defined(OPENSSL_NO_RSA)
761.   	rmsg.buf = tempbuf;
762. > 	rmsg.size = sizeof(tempbuf);
763.   #endif
764.   

engines/e_ncipher.c:765:6: Taking false branch
763.   #endif
764.   
765.   	if(!hwcrhk_context)
            ^
766.   		{
767.   		HWCRHKerr(HWCRHK_F_HWCRHK_LOAD_PRIVKEY,

engines/e_ncipher.c:772:2: 
770.   		}
771.   #ifndef OPENSSL_NO_RSA
772. > 	hptr = OPENSSL_malloc(sizeof(HWCryptoHook_RSAKeyHandle));
773.   	if (!hptr)
774.   		{

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 true 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:314:20: 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)

engines/e_ncipher.c:773:7: Taking false branch
771.   #ifndef OPENSSL_NO_RSA
772.   	hptr = OPENSSL_malloc(sizeof(HWCryptoHook_RSAKeyHandle));
773.   	if (!hptr)
             ^
774.   		{
775.   		HWCRHKerr(HWCRHK_F_HWCRHK_LOAD_PRIVKEY,

engines/e_ncipher.c:779:9: 
777.   		goto err;
778.   		}
779. >         ppctx.ui_method = ui_method;
780.   	ppctx.callback_data = callback_data;
781.   	if (p_hwcrhk_RSALoadKey(hwcrhk_context, key_id, hptr,

engines/e_ncipher.c:780:2: 
778.   		}
779.           ppctx.ui_method = ui_method;
780. > 	ppctx.callback_data = callback_data;
781.   	if (p_hwcrhk_RSALoadKey(hwcrhk_context, key_id, hptr,
782.   		&rmsg, &ppctx))

engines/e_ncipher.c:781:6: Taking false branch
779.           ppctx.ui_method = ui_method;
780.   	ppctx.callback_data = callback_data;
781.   	if (p_hwcrhk_RSALoadKey(hwcrhk_context, key_id, hptr,
            ^
782.   		&rmsg, &ppctx))
783.   		{

engines/e_ncipher.c:789:7: Taking false branch
787.   		goto err;
788.   		}
789.   	if (!*hptr)
             ^
790.   		{
791.   		HWCRHKerr(HWCRHK_F_HWCRHK_LOAD_PRIVKEY,

engines/e_ncipher.c:797:2: 
795.   #endif
796.   #ifndef OPENSSL_NO_RSA
797. > 	rtmp = RSA_new_method(eng);
798.   	RSA_set_ex_data(rtmp, hndidx_rsa, (char *)hptr);
799.   	rtmp->e = BN_new();

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)

engines/e_ncipher.c:798:2: 
796.   #ifndef OPENSSL_NO_RSA
797.   	rtmp = RSA_new_method(eng);
798. > 	RSA_set_ex_data(rtmp, hndidx_rsa, (char *)hptr);
799.   	rtmp->e = BN_new();
800.   	rtmp->n = BN_new();
