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


engines/e_sureware.c:644:1: start of procedure sureware_load_public()
642.   }
643.   
644. > static EVP_PKEY* sureware_load_public(ENGINE *e,const char *key_id,char *hptr,unsigned long el,char keytype)
645.   {
646.   	EVP_PKEY *res = NULL;

engines/e_sureware.c:646:2: 
644.   static EVP_PKEY* sureware_load_public(ENGINE *e,const char *key_id,char *hptr,unsigned long el,char keytype)
645.   {
646. > 	EVP_PKEY *res = NULL;
647.   #ifndef OPENSSL_NO_RSA
648.   	RSA *rsatmp = NULL;

engines/e_sureware.c:648:2: 
646.   	EVP_PKEY *res = NULL;
647.   #ifndef OPENSSL_NO_RSA
648. > 	RSA *rsatmp = NULL;
649.   #endif
650.   #ifndef OPENSSL_NO_DSA

engines/e_sureware.c:651:2: 
649.   #endif
650.   #ifndef OPENSSL_NO_DSA
651. > 	DSA *dsatmp=NULL;
652.   #endif
653.   	char msg[64]="sureware_load_public";

engines/e_sureware.c:653:2: 
651.   	DSA *dsatmp=NULL;
652.   #endif
653. > 	char msg[64]="sureware_load_public";
654.   	int ret=0;
655.   	if(!p_surewarehk_Load_Rsa_Pubkey || !p_surewarehk_Load_Dsa_Pubkey)

engines/e_sureware.c:654:2: 
652.   #endif
653.   	char msg[64]="sureware_load_public";
654. > 	int ret=0;
655.   	if(!p_surewarehk_Load_Rsa_Pubkey || !p_surewarehk_Load_Dsa_Pubkey)
656.   	{

engines/e_sureware.c:655:6: Taking false branch
653.   	char msg[64]="sureware_load_public";
654.   	int ret=0;
655.   	if(!p_surewarehk_Load_Rsa_Pubkey || !p_surewarehk_Load_Dsa_Pubkey)
            ^
656.   	{
657.   		SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PUBLIC_KEY,ENGINE_R_NOT_INITIALISED);

engines/e_sureware.c:655:39: Taking false branch
653.   	char msg[64]="sureware_load_public";
654.   	int ret=0;
655.   	if(!p_surewarehk_Load_Rsa_Pubkey || !p_surewarehk_Load_Dsa_Pubkey)
                                             ^
656.   	{
657.   		SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PUBLIC_KEY,ENGINE_R_NOT_INITIALISED);

engines/e_sureware.c:660:2: 
658.   		goto err;
659.   	}
660. > 	switch (keytype)
661.   	{
662.   #ifndef OPENSSL_NO_RSA

engines/e_sureware.c:663:2: Switch condition is true. Entering switch case
661.   	{
662.   #ifndef OPENSSL_NO_RSA
663.   	case 1: /*RSA*/
        ^
664.   		/* set private external reference */
665.   		rsatmp = RSA_new_method(e);

engines/e_sureware.c:665:3: 
663.   	case 1: /*RSA*/
664.   		/* set private external reference */
665. > 		rsatmp = RSA_new_method(e);
666.   		RSA_set_ex_data(rsatmp,rsaHndidx,hptr);
667.   		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: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 false branch
    297.   
    298.   	allow_customize = 0;
    299.   	if (malloc_debug_func != NULL)
                ^
    300.   		{
    301.   		allow_customize_debug = 0;

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 false 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: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:664:1: start of procedure ERR_put_error()
    662.   /********************************************************/
    663.   
    664. > void ERR_put_error(int lib, int func, int reason, const char *file,
    665.   	     int line)
    666.   	{

crypto/err/err.c:688:2: Skipping ERR_get_state(): empty list of specs
    686.   	}
    687.   #endif
    688.   	es=ERR_get_state();
            ^
    689.   
    690.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:690:2: 
    688.   	es=ERR_get_state();
    689.   
    690. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    691.   	if (es->top == es->bottom)
    692.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:691:6: Taking false branch
    689.   
    690.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    691.   	if (es->top == es->bottom)
                ^
    692.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    693.   	es->err_flags[es->top]=0;

crypto/err/err.c:693:2: 
    691.   	if (es->top == es->bottom)
    692.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    693. > 	es->err_flags[es->top]=0;
    694.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    695.   	es->err_file[es->top]=file;

crypto/err/err.c:694:2: 
    692.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    693.   	es->err_flags[es->top]=0;
    694. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    695.   	es->err_file[es->top]=file;
    696.   	es->err_line[es->top]=line;

crypto/err/err.c:695:2: 
    693.   	es->err_flags[es->top]=0;
    694.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    695. > 	es->err_file[es->top]=file;
    696.   	es->err_line[es->top]=line;
    697.   	err_clear_data(es,es->top);

crypto/err/err.c:696:2: 
    694.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    695.   	es->err_file[es->top]=file;
    696. > 	es->err_line[es->top]=line;
    697.   	err_clear_data(es,es->top);
    698.   	}

crypto/err/err.c:697:2: Taking true branch
    695.   	es->err_file[es->top]=file;
    696.   	es->err_line[es->top]=line;
    697.   	err_clear_data(es,es->top);
            ^
    698.   	}
    699.   

crypto/err/err.c:697:2: Taking false branch
    695.   	es->err_file[es->top]=file;
    696.   	es->err_line[es->top]=line;
    697.   	err_clear_data(es,es->top);
            ^
    698.   	}
    699.   

crypto/err/err.c:697:2: Loop condition is false. Leaving loop
    695.   	es->err_file[es->top]=file;
    696.   	es->err_line[es->top]=line;
    697.   	err_clear_data(es,es->top);
            ^
    698.   	}
    699.   

crypto/err/err.c:698:2: return from a call to ERR_put_error
    696.   	es->err_line[es->top]=line;
    697.   	err_clear_data(es,es->top);
    698.   	}
            ^
    699.   
    700.   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_sureware.c:666:3: 
664.   		/* set private external reference */
665.   		rsatmp = RSA_new_method(e);
666. > 		RSA_set_ex_data(rsatmp,rsaHndidx,hptr);
667.   		rsatmp->flags |= RSA_FLAG_EXT_PKEY;
668.   
