engines/e_sureware.c:674: error: NULL_DEREFERENCE
  pointer `rsatmp` last assigned on line 673 could be null and is dereferenced by call to `RSA_set_ex_data()` at line 674, column 3.
Showing all 40 steps of the trace


engines/e_sureware.c:652:1: start of procedure sureware_load_public()
650.   }
651.   
652. > static EVP_PKEY* sureware_load_public(ENGINE *e,const char *key_id,char *hptr,unsigned long el,char keytype)
653.   {
654.   	EVP_PKEY *res = NULL;

engines/e_sureware.c:654:2: 
652.   static EVP_PKEY* sureware_load_public(ENGINE *e,const char *key_id,char *hptr,unsigned long el,char keytype)
653.   {
654. > 	EVP_PKEY *res = NULL;
655.   #ifndef OPENSSL_NO_RSA
656.   	RSA *rsatmp = NULL;

engines/e_sureware.c:656:2: 
654.   	EVP_PKEY *res = NULL;
655.   #ifndef OPENSSL_NO_RSA
656. > 	RSA *rsatmp = NULL;
657.   #endif
658.   #ifndef OPENSSL_NO_DSA

engines/e_sureware.c:659:2: 
657.   #endif
658.   #ifndef OPENSSL_NO_DSA
659. > 	DSA *dsatmp=NULL;
660.   #endif
661.   	char msg[64]="sureware_load_public";

engines/e_sureware.c:661:2: 
659.   	DSA *dsatmp=NULL;
660.   #endif
661. > 	char msg[64]="sureware_load_public";
662.   	int ret=0;
663.   	if(!p_surewarehk_Load_Rsa_Pubkey || !p_surewarehk_Load_Dsa_Pubkey)

engines/e_sureware.c:662:2: 
660.   #endif
661.   	char msg[64]="sureware_load_public";
662. > 	int ret=0;
663.   	if(!p_surewarehk_Load_Rsa_Pubkey || !p_surewarehk_Load_Dsa_Pubkey)
664.   	{

engines/e_sureware.c:663:6: Taking false branch
661.   	char msg[64]="sureware_load_public";
662.   	int ret=0;
663.   	if(!p_surewarehk_Load_Rsa_Pubkey || !p_surewarehk_Load_Dsa_Pubkey)
            ^
664.   	{
665.   		SUREWAREerr(SUREWARE_F_SUREWARE_LOAD_PUBLIC,ENGINE_R_NOT_INITIALISED);

engines/e_sureware.c:663:39: Taking false branch
661.   	char msg[64]="sureware_load_public";
662.   	int ret=0;
663.   	if(!p_surewarehk_Load_Rsa_Pubkey || !p_surewarehk_Load_Dsa_Pubkey)
                                             ^
664.   	{
665.   		SUREWAREerr(SUREWARE_F_SUREWARE_LOAD_PUBLIC,ENGINE_R_NOT_INITIALISED);

engines/e_sureware.c:668:2: 
666.   		goto err;
667.   	}
668. > 	switch (keytype)
669.   	{
670.   #ifndef OPENSSL_NO_RSA

engines/e_sureware.c:671:2: Switch condition is true. Entering switch case
669.   	{
670.   #ifndef OPENSSL_NO_RSA
671.   	case 1: /*RSA*/
        ^
672.   		/* set private external reference */
673.   		rsatmp = RSA_new_method(e);

engines/e_sureware.c:673:3: 
671.   	case 1: /*RSA*/
672.   		/* set private external reference */
673. > 		rsatmp = RSA_new_method(e);
674.   		RSA_set_ex_data(rsatmp,rsaHndidx,hptr);
675.   		rsatmp->flags |= RSA_FLAG_EXT_PKEY;

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:294:1: start of procedure CRYPTO_malloc()
    292.   	}
    293.   
    294. > void *CRYPTO_malloc(int num, const char *file, int line)
    295.   	{
    296.   	void *ret = NULL;

crypto/mem.c:296:2: 
    294.   void *CRYPTO_malloc(int num, const char *file, int line)
    295.   	{
    296. > 	void *ret = NULL;
    297.   
    298.   	if (num <= 0) return NULL;

crypto/mem.c:298:6: Taking false branch
    296.   	void *ret = NULL;
    297.   
    298.   	if (num <= 0) return NULL;
                ^
    299.   
    300.   	allow_customize = 0;

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

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

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

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

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

crypto/mem.c:323:2: 
    321.   #endif
    322.   
    323. > 	return ret;
    324.   	}
    325.   

crypto/mem.c:324:2: return from a call to CRYPTO_malloc
    322.   
    323.   	return ret;
    324.   	}
            ^
    325.   
    326.   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:706:1: start of procedure ERR_put_error()
    704.   /********************************************************/
    705.   
    706. > void ERR_put_error(int lib, int func, int reason, const char *file,
    707.   	     int line)
    708.   	{

crypto/err/err.c:730:2: Skipping ERR_get_state(): empty list of specs
    728.   	}
    729.   #endif
    730.   	es=ERR_get_state();
            ^
    731.   
    732.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:732:2: 
    730.   	es=ERR_get_state();
    731.   
    732. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    733.   	if (es->top == es->bottom)
    734.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:733:6: Taking false branch
    731.   
    732.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    733.   	if (es->top == es->bottom)
                ^
    734.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    735.   	es->err_flags[es->top]=0;

crypto/err/err.c:735:2: 
    733.   	if (es->top == es->bottom)
    734.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    735. > 	es->err_flags[es->top]=0;
    736.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    737.   	es->err_file[es->top]=file;

crypto/err/err.c:736:2: 
    734.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    735.   	es->err_flags[es->top]=0;
    736. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    737.   	es->err_file[es->top]=file;
    738.   	es->err_line[es->top]=line;

crypto/err/err.c:737:2: 
    735.   	es->err_flags[es->top]=0;
    736.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    737. > 	es->err_file[es->top]=file;
    738.   	es->err_line[es->top]=line;
    739.   	err_clear_data(es,es->top);

crypto/err/err.c:738:2: 
    736.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    737.   	es->err_file[es->top]=file;
    738. > 	es->err_line[es->top]=line;
    739.   	err_clear_data(es,es->top);
    740.   	}

crypto/err/err.c:739:2: Taking true branch
    737.   	es->err_file[es->top]=file;
    738.   	es->err_line[es->top]=line;
    739.   	err_clear_data(es,es->top);
            ^
    740.   	}
    741.   

crypto/err/err.c:739:2: Taking false branch
    737.   	es->err_file[es->top]=file;
    738.   	es->err_line[es->top]=line;
    739.   	err_clear_data(es,es->top);
            ^
    740.   	}
    741.   

crypto/err/err.c:739:2: Loop condition is false. Leaving loop
    737.   	es->err_file[es->top]=file;
    738.   	es->err_line[es->top]=line;
    739.   	err_clear_data(es,es->top);
            ^
    740.   	}
    741.   

crypto/err/err.c:740:2: return from a call to ERR_put_error
    738.   	es->err_line[es->top]=line;
    739.   	err_clear_data(es,es->top);
    740.   	}
            ^
    741.   
    742.   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:197:2: return from a call to RSA_new_method
  195.   		}
  196.   	return(ret);
  197.   	}
          ^
  198.   
  199.   void RSA_free(RSA *r)

engines/e_sureware.c:674:3: 
672.   		/* set private external reference */
673.   		rsatmp = RSA_new_method(e);
674. > 		RSA_set_ex_data(rsatmp,rsaHndidx,hptr);
675.   		rsatmp->flags |= RSA_FLAG_EXT_PKEY;
676.   
