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


ssl/d1_both.c:1151:1: start of procedure dtls1_buffer_message()
1149.   	}
1150.   
1151. > int
1152.   dtls1_buffer_message(SSL *s, int is_ccs)
1153.   	{

ssl/d1_both.c:1160:2: Condition is true
1158.   	/* this function is called immediately after a message has 
1159.   	 * been serialized */
1160.   	OPENSSL_assert(s->init_off == 0);
         ^
1161.   
1162.   	frag = dtls1_hm_fragment_new(s->init_num, 0);

ssl/d1_both.c:1162:2: 
1160.   	OPENSSL_assert(s->init_off == 0);
1161.   
1162. > 	frag = dtls1_hm_fragment_new(s->init_num, 0);
1163.   
1164.   	memcpy(frag->fragment, s->init_buf->data, s->init_num);

ssl/d1_both.c:173:1: start of procedure dtls1_hm_fragment_new()
  171.   	long max, int *ok);
  172.   
  173. > static hm_fragment *
  174.   dtls1_hm_fragment_new(unsigned long frag_len, int reassembly)
  175.   	{

ssl/d1_both.c:176:2: 
  174.   dtls1_hm_fragment_new(unsigned long frag_len, int reassembly)
  175.   	{
  176. > 	hm_fragment *frag = NULL;
  177.   	unsigned char *buf = NULL;
  178.   	unsigned char *bitmask = NULL;

ssl/d1_both.c:177:2: 
  175.   	{
  176.   	hm_fragment *frag = NULL;
  177. > 	unsigned char *buf = NULL;
  178.   	unsigned char *bitmask = NULL;
  179.   

ssl/d1_both.c:178:2: 
  176.   	hm_fragment *frag = NULL;
  177.   	unsigned char *buf = NULL;
  178. > 	unsigned char *bitmask = NULL;
  179.   
  180.   	frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment));

ssl/d1_both.c:180:2: 
  178.   	unsigned char *bitmask = NULL;
  179.   
  180. > 	frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment));
  181.   	if ( frag == NULL)
  182.   		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.   char *CRYPTO_strdup(const char *str, const char *file, int line)

crypto/mem.c:324:2: return from a call to CRYPTO_malloc
    322.   
    323.   	return ret;
    324.   	}
            ^
    325.   char *CRYPTO_strdup(const char *str, const char *file, int line)
    326.   	{

ssl/d1_both.c:181:7: Taking true branch
  179.   
  180.   	frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment));
  181.   	if ( frag == NULL)
               ^
  182.   		return NULL;
  183.   

ssl/d1_both.c:182:3: 
  180.   	frag = (hm_fragment *)OPENSSL_malloc(sizeof(hm_fragment));
  181.   	if ( frag == NULL)
  182. > 		return NULL;
  183.   
  184.   	if (frag_len)

ssl/d1_both.c:213:2: return from a call to dtls1_hm_fragment_new
  211.   
  212.   	return frag;
  213.   	}
          ^
  214.   
  215.   static void

ssl/d1_both.c:1164:2: 
1162.   	frag = dtls1_hm_fragment_new(s->init_num, 0);
1163.   
1164. > 	memcpy(frag->fragment, s->init_buf->data, s->init_num);
1165.   
1166.   	if ( is_ccs)
