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


engines/e_sureware.c:639:1: start of procedure sureware_load_public()
637.   }
638.   
639. > static EVP_PKEY* sureware_load_public(ENGINE *e,const char *key_id,char *hptr,unsigned long el,char keytype)
640.   {
641.   	EVP_PKEY *res = NULL;

engines/e_sureware.c:641:2: 
639.   static EVP_PKEY* sureware_load_public(ENGINE *e,const char *key_id,char *hptr,unsigned long el,char keytype)
640.   {
641. > 	EVP_PKEY *res = NULL;
642.   #ifndef OPENSSL_NO_RSA
643.   	RSA *rsatmp = NULL;

engines/e_sureware.c:643:2: 
641.   	EVP_PKEY *res = NULL;
642.   #ifndef OPENSSL_NO_RSA
643. > 	RSA *rsatmp = NULL;
644.   #endif
645.   #ifndef OPENSSL_NO_DSA

engines/e_sureware.c:646:2: 
644.   #endif
645.   #ifndef OPENSSL_NO_DSA
646. > 	DSA *dsatmp=NULL;
647.   #endif
648.   	char msg[64]="sureware_load_public";

engines/e_sureware.c:648:2: 
646.   	DSA *dsatmp=NULL;
647.   #endif
648. > 	char msg[64]="sureware_load_public";
649.   	int ret=0;
650.   	if(!p_surewarehk_Load_Rsa_Pubkey || !p_surewarehk_Load_Dsa_Pubkey)

engines/e_sureware.c:649:2: 
647.   #endif
648.   	char msg[64]="sureware_load_public";
649. > 	int ret=0;
650.   	if(!p_surewarehk_Load_Rsa_Pubkey || !p_surewarehk_Load_Dsa_Pubkey)
651.   	{

engines/e_sureware.c:650:6: Taking false branch
648.   	char msg[64]="sureware_load_public";
649.   	int ret=0;
650.   	if(!p_surewarehk_Load_Rsa_Pubkey || !p_surewarehk_Load_Dsa_Pubkey)
            ^
651.   	{
652.   		SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PUBLIC_KEY,ENGINE_R_NOT_INITIALISED);

engines/e_sureware.c:650:39: Taking false branch
648.   	char msg[64]="sureware_load_public";
649.   	int ret=0;
650.   	if(!p_surewarehk_Load_Rsa_Pubkey || !p_surewarehk_Load_Dsa_Pubkey)
                                             ^
651.   	{
652.   		SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PUBLIC_KEY,ENGINE_R_NOT_INITIALISED);

engines/e_sureware.c:655:2: 
653.   		goto err;
654.   	}
655. > 	switch (keytype)
656.   	{
657.   #ifndef OPENSSL_NO_RSA

engines/e_sureware.c:658:2: Switch condition is true. Entering switch case
656.   	{
657.   #ifndef OPENSSL_NO_RSA
658.   	case 1: /*RSA*/
        ^
659.   		/* set private external reference */
660.   		rsatmp = RSA_new_method(e);

engines/e_sureware.c:660:3: 
658.   	case 1: /*RSA*/
659.   		/* set private external reference */
660. > 		rsatmp = RSA_new_method(e);
661.   		RSA_set_ex_data(rsatmp,rsaHndidx,hptr);
662.   		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: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_sureware.c:661:3: 
659.   		/* set private external reference */
660.   		rsatmp = RSA_new_method(e);
661. > 		RSA_set_ex_data(rsatmp,rsaHndidx,hptr);
662.   		rsatmp->flags |= RSA_FLAG_EXT_PKEY;
663.   
