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


ssl/d1_both.c:1155:1: start of procedure dtls1_buffer_message()
1153.   	}
1154.   
1155. > int
1156.   dtls1_buffer_message(SSL *s, int is_ccs)
1157.   	{

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

ssl/d1_both.c:1166:2: 
1164.   	OPENSSL_assert(s->init_off == 0);
1165.   
1166. > 	frag = dtls1_hm_fragment_new(s->init_num, 0);
1167.   
1168.   	memcpy(frag->fragment, s->init_buf->data, s->init_num);

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

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

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

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

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

crypto/mem.c:297:1: start of procedure CRYPTO_malloc()
    295.   	}
    296.   
    297. > void *CRYPTO_malloc(int num, const char *file, int line)
    298.   	{
    299.   	void *ret = NULL;

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

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

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

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

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

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

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

crypto/mem.c:326:2: 
    324.   #endif
    325.   
    326. > 	return ret;
    327.   	}
    328.   char *CRYPTO_strdup(const char *str, const char *file, int line)

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

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

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

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

ssl/d1_both.c:1168:2: 
1166.   	frag = dtls1_hm_fragment_new(s->init_num, 0);
1167.   
1168. > 	memcpy(frag->fragment, s->init_buf->data, s->init_num);
1169.   
1170.   	if ( is_ccs)
