ssl/d1_both.c:1050: error: NULL_DEREFERENCE
  pointer `frag` last assigned on line 1048 could be null and is dereferenced at line 1050, column 9.
Showing all 21 steps of the trace


ssl/d1_both.c:1037:1: start of procedure dtls1_buffer_message()
1035.   #endif
1036.   
1037. > int
1038.   dtls1_buffer_message(SSL *s, int is_ccs)
1039.   	{

ssl/d1_both.c:1046:2: Condition is true
1044.   	/* this function is called immediately after a message has 
1045.   	 * been serialized */
1046.   	OPENSSL_assert(s->init_off == 0);
         ^
1047.   
1048.   	frag = dtls1_hm_fragment_new(s->init_num);

ssl/d1_both.c:1048:2: 
1046.   	OPENSSL_assert(s->init_off == 0);
1047.   
1048. > 	frag = dtls1_hm_fragment_new(s->init_num);
1049.   
1050.   	memcpy(frag->fragment, s->init_buf->data, s->init_num);

ssl/d1_both.c:144:1: start of procedure dtls1_hm_fragment_new()
  142.   static void dtls1_process_handshake_fragment(SSL *s, int frag_len);
  143.   
  144. > static hm_fragment *
  145.   dtls1_hm_fragment_new(unsigned long frag_len)
  146.   	{

ssl/d1_both.c:147:2: 
  145.   dtls1_hm_fragment_new(unsigned long frag_len)
  146.   	{
  147. > 	hm_fragment *frag = NULL;
  148.   	unsigned char *buf = NULL;
  149.   

ssl/d1_both.c:148:2: 
  146.   	{
  147.   	hm_fragment *frag = NULL;
  148. > 	unsigned char *buf = NULL;
  149.   
  150.   	frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment));

ssl/d1_both.c:150:2: 
  148.   	unsigned char *buf = NULL;
  149.   
  150. > 	frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment));
  151.   	if ( frag == NULL)
  152.   		return NULL;

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)

ssl/d1_both.c:151:7: Taking true branch
  149.   
  150.   	frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment));
  151.   	if ( frag == NULL)
               ^
  152.   		return NULL;
  153.   

ssl/d1_both.c:152:3: 
  150.   	frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment));
  151.   	if ( frag == NULL)
  152. > 		return NULL;
  153.   
  154.   	buf = (unsigned char *)OPENSSL_malloc(frag_len 

ssl/d1_both.c:165:2: return from a call to dtls1_hm_fragment_new
  163.   
  164.   	return frag;
  165.   	}
          ^
  166.   
  167.   static void

ssl/d1_both.c:1050:2: 
1048.   	frag = dtls1_hm_fragment_new(s->init_num);
1049.   
1050. > 	memcpy(frag->fragment, s->init_buf->data, s->init_num);
1051.   
1052.   	if ( is_ccs)
